Checking Validity

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

% java dom.Counter -v invalidhotcop.xml
[Error] invalidhotcop.xml:10:8: The content of element type "SONG" must match 
"(TITLE,COMPOSER+,PRODUCER*,PUBLISHER*,LENGTH?,YEAR?,ARTIST+)".
invalidhotcop.xml: 862;70;0 ms (7 elems, 0 attrs, 19 spaces, 59 chars)

A valid document:

% java dom.Counter -v validhotcop.xml
validhotcop.xml: 671;70;0 ms (10 elems, 0 attrs, 28 spaces, 98 chars)

Previous | Next | Top | Cafe con Leche

Copyright 2002, 2003 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified April 4, 2002