Using the the Sun/Oracle Multi-Schema XML Validator (MSV)

less than 1 minute read

I regularly work with more or less complex XML Schemas, and debugging those requires some tools with command lines I usually forget after a while. So I decided to write down some of my frequently used command lines for MSV, the Sun/Oracle Multi-Schema XML Validator. Maybe you find some of those helpful as well (since the MSV documentation is not exactly perfect).

Note: While I only use MSV for XML Schema validation, it can be used for RelaxNG and other schema languages as well.

Get MSV

That's the easy part: download a binary build from http://java.net/downloads/msv/releases/ and unzip it (you only need the msv.YYYYMMDD.zip).

Validate a XML document

$> cd msv-20090415
$> java -jar msv.jar schema.xsd document.xml
start parsing a grammar.
validating document.xml
the document is valid.

Dump the post-schema-validation infoset (PSVI)

Often it is useful to see which type the XML Schema parser attached to a node in a document. To do this, get the post-schema-validation infoset (PSVI) from the schema validator. With MSV comes a sample application that can be used for this purpose.
$> cd msv-20090415/examples
$> java -cp .:../msv.jar psvi.PSVIDump schema.xsd document.xml