Lists Home |
Date Index |
> Can somebody please tell me how to validate an XML document
> with a given XSD ?
> Is the XSD validator part of an XML library [like Xerces,
> libxml2 etc] itself or there exist some separate library to
> validate an XML document using XSD ?
There are a number of tools including Xerces, MSXML, XSV.
The way you do validation depends on the tool that you are using. If you
install the schema-aware version of Saxon, you can use the command line:
java com.saxonica.Validate source.xml schema.xsd
I find that the easiest way to do ad-hoc validation (i.e., not integrated
into an application) is to use a tool such as Stylus Studio. One of the nice
things is that Stylus allows you to validate using a range of different
processors - if your document is invalid, it can be helpful to get the error
messages from more than one processor. By contrast, XML Spy uses its own
schema processor, which is not always 100% conformant with the spec.