Judging by the popularity of this question on Stack Overflow (and my answer), it seems that a lot of people struggle to check the validity of an XML file against an XML Schema.
This entry was posted on Thursday, November 21st, 2013 at pm.
You can follow any responses to this entry through the RSS 2.0 feed.
We’ll start by looking at what is probably the fastest and easiest option to get started with validation: A web search reveals the Core Filing XML Schema Validator and the Free Formatter Validator amongst others.
The Core Filing offering only allows uploading of files, whereas Free Formatter allows either pasting of documents or pointing to URLs (but not uploading files! Both work fine and seem to use the Apache Xerces parser underneath the hood, which I’ll talk more about in the next section.
The final choice is to use an editor with XSD support.
I don’t have any experience of this, but if you’re doing a lot of XML editing and validation it may well be worth looking into one of the following: Please be aware that due to the complexity of the Schema specification, there are differences between the validators; a document that is valid under one implementation may not be valid under another.
For this reason you may want to double check with another validator (I find xmllint’s error messages and ease of use make it very useful when rapidly iterating during development of XML/XSD files). It exists in both C and Java versions (I believe a customised version of Xerces is bundled in the Sun JDK).
However, there isn’t a simple way to immediately run the Xerces validator from the command line.
Used to exercise the pattern recognition engine, which can be used with the reader interface to the parser.
It allows to select some nodes in the document based on an XPath (subset) expression.
I was hoping to find a command line utility for running Microsoft’s MSXML validator, but I failed to find any projects I liked.