WIKI HELP

XML Schema Validator

Once upon a project, I had a hard time deploying my code to an application server. Turns out, the application server on the production machine had stricter XML validation rules than the one on my laptop. So…how do I validate my XML files in advance? I couldn't find anything, so I wrote my own.

This class parses an XML file and validates it against its DTD. This ensures the document is well-formed XML, that all the namespaces are valid, and that the document matches its DTD. It uses classes from the Apache Xerces project.

Schema and namespace validation can be turned off by commenting out the appropriate feature in the code