Friday, July 23, 2004

xerces command line utility

It has taken me an hour to figure this out, so I might save you some time.

If you want to use xerces-j to validate an XML instance against an XSD schema that is specified on the command line (as opposed to using schemaLocation attribute), do this:

java dom.ASBuilder -a foo.xsd -i foo.xml

The FAQ for Using XML Schemas on the apache website says (my italics):

"Each document that uses XML Schema grammars *must* specify the location of the grammars it uses by using an xsi:schemaLocation attribute if they use namespaces, and an xsi:noNamespaceSchemaLocation attribute otherwise."

This is a tad misleading.

No comments: