Search code examples
xmlvalidationsaxonxmllintxsd-1.1

Validate XML against XSD 1.1 schema / XSD (using Saxon-B / saxon 9.1.0.8) on command line (Linux)


I have been trying for several days now to get a linux command line validation of XML against an 1.1 Schema/XSD to work. (I don't really care about the tool, as long is it is a free linux tool supporting xsd 1.1 statements like "assert")

So far I have found / tried:

  • xmllint (seems it does not support XSD 1.1 Schema?) (I have used xmllint in the past for xsd 1.0 very successfully)

  • Newest Version of Saxon only supports XSD validation with Enterprise Edition (EE) - which I don't have.

  • numerous threads here on stackoverflow, including a tool one of them provided

  • Supposedly it is as easy as calling java com.saxonica.Validate [options] source.xml...

  • I have to use -xsdversion:1.1 when calling the validator

  • Many people claiming it works with Saxon-B, but no concrete example

  • I have downloaded the source for Saxon-B / saxon 9.1.0.8 from SF, but to no avail in finding the "com.saxonica.Validate" class (shouldn't it be net.sf.saxon. ...)

  • Calling for example:

./java -cp "<path to saxon libs>/lib/saxon-9.1.0.8.jar" com.saxonica.Validate /home/<myuser>/test.xml Fehler: Hauptklasse com.saxonica.Validate konnte nicht gefunden oder geladen werden

("Main Class could not be found") (Oviously I need to provide more options to validate against a schema, but since the class can not be found, ...)

Running Java 1.7 build 71

bin$ ./java -version java version "1.7.0_71" Java(TM) SE Runtime Environment (build 1.7.0_71-b14) Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Has anyone got a working example of a tool (preferably saxon-B) where I can validate XML against XSD 1.1 on linux command Line?

Thank you,

e


Solution

  • To use the Saxon schema validator, you need Saxon Enterprise Edition; the minimum license needed is EEV, which costs £90. You can get a free 30-day evaluation license from www.saxonica.com. Schema processing is not available in the open source versions of Saxon (Saxon-B, Saxon-HE), and never has been.

    There is a version of Apache Xerces that supports XSD 1.1 but I can't give you any help with it, I'm afraid. There is also a commercial XSD 1.1 implementation from Altova.