I have a library Saxon9ee.jar and I want to validate XML file against DTD schema located in external file (not inside XML) using Saxon9ee with command line interface. I found out how to validate XML against XSD schema:
java -cp saxon9ee.jar com.saxonica.Validate -xsd:<XSD_file> -s:<XML_file> -xsdversion:1.1
But how can I do the same with DTD schema file?
Validating against a DTD doesn't really involve Saxon at all, it's all done in the XML parser. But oddly, the Xerces parser is rather poor in terms of command line interfaces, so invoking it via Saxon is probably the most convenient way of doing it. Run the simplest possible query, with DTD validation enabled:
java net.sf.saxon.Query -qs:. -s:source.xml -dtd:on
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With