Checking Validity

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

% java XJParse -p com.ibm.xml.parsers.ValidatingParser invalidhotcop.xml
Error at (file file:/D:/speaking/SD99EAST/dtds/invalidhotcop.xml, line 10, char
8): Element "<SONG>" is not valid because it does not follow the rule, "(TITLE,C
OMPOSER+,PRODUCER*,PUBLISHER*,LENGTH?,YEAR?,ARTIST+)".
invalidhotcop.xml: 281 ms

A valid document:

% java XJParse -p com.ibm.xml.parsers.ValidatingParser validhotcop.xml
validhotcop.xml: 170 ms


Previous | Next | Top | Cafe con Leche

Copyright 1999 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified October 8, 1999