Validate XML against Relax NG Schema
To validate an XML Document against a Relax NG Schema, you need to associate your XML Document with the Relax NG Schema: Click Schema > Associate XML Document with DTD, Relax NG Schema, or XSD..., and select a Relax NG Schema. XMLBlueprint uses the xml-model processing instruction for this:
<?xml-model href="book.rng" schematypens="https://relaxng.org/ns/structure/1.0?>
<book>
</book>
This tells XMLBlueprint to validate the XML Document against Relax NG Schema "book.rng". In this case, the Relax NG Schema 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.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
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.rng":
<?xml-model href="file:///C:/XMLBlueprint/book.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
It's not allowed to use a Windows-like path syntax:
<?xml-model href="C:\XMLBlueprint\book.rng" schematypens="https://relaxng.org/ns/structure/1.0"?> (WRONG!)
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