Checking Validity

To check validity you pass the document through a validating parser which should report any errors it finds. For example,

$ xmllint --valid --noout invalidhotcop.xml
invalidhotcop.xml:10: element SONG: validity error : Element 
SONG content does not follow the DTD, expecting 
(TITLE , COMPOSER+ , PRODUCER* , PUBLISHER* , LENGTH? , 
YEAR? , ARTIST+), got (TITLE PRODUCER PUBLISHER LENGTH 
YEAR ARTIST )
</SONG>
       ^

A valid document:

$ xmllint --valid --noout validhotcop.xml
$

Previous | Next | Top | Cafe con Leche

Copyright 2002-2006 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified December 9, 2005