Validate XML against Schematron
To validate an XML Document against a Schematron, you need to associate your XML Document with the Schematron. XMLBlueprint uses the xml-model processing instruction for this:
<?xml-model href="book.sch" schematypens="http://purl.oclc.org/dsdl/schematron?>
<book>
</book>
This tells XMLBlueprint to validate the XML Document against Schematron "book.sch". In this case, the Schematron is to be found in the same folder as the XML Document. It is also possible to specify an absolute location:
<?xml-model href="https://www.xmlblueprint.com/schemas/book.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?>
Beware that you must always specify the location of the schema in URL Syntax, even if the schema is located on your own computer. For instance, if the schema is located at "C:\XMLBlueprint\book.sch":
<?xml-model href="file:///C:/XMLBlueprint/book.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?>
It's not allowed to use a Windows-like path syntax:
<?xml-model href="C:\XMLBlueprint\book.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?> (WRONG!)
To validate:
Open your XML Document in the XML Editor.
Click XML > Validate.
The Errors view is automatically displayed to show any errors in the XML Document. Click on the error message to jump to the position where the error occurred.
See Also