I am using xmllint to do some validations and I have an XML instance document which needs to validate against two schemas: one for the outer \"envelope\" (which includes an
I quit on xmllint and used Xerces instead.
I downloaded Xerces tarball and after exploding it to some local folder I created the following validate script based on this suggestion (from web archive - original link being now dead):
#!/bin/bash
XERCES_HOME=~/software-downloads/xerces-2_11_0/
echo $XERCES_HOME
java -classpath $XERCES_HOME/xercesImpl.jar:$XERCES_HOME/xml-apis.jar:$XERCES_HOME/xercesSamples.jar sax.Counter $*
The ab.xml file is then validated, against both schemas, with the following command:
validate -v -n -np -s -f ab.xml
Xerces is reading the schema locations from the xsi:schemaLocation element in ab.xml so they don't need to be provided in the command line invocation.