XML-Model Processing Instruction for Modern XML Schemas

The xml-model processing instruction provides a standardized, flexible mechanism for associating XML documents with one or more schema definitions. Unlike legacy linking methods tied to specific schema languages, xml-model allows authors to link modern validation technologies—including RELAX NG, Schematron, NVDL, and W3C XML Schema (XSD)—directly within the document prolog. This article explains the purpose, syntax, and advantages of using xml-model to manage document validation in modern XML workflows.

Limitations of Legacy Schema Association

Historically, linking schemas to XML documents relied on rigid, single-purpose mechanisms:

These traditional methods cannot easily accommodate modern schema languages or scenarios where a document requires validation against multiple complementary schemas.

Purpose of the xml-model Processing Instruction

Standardized by the W3C and ISO/IEC 19757-11, the xml-model processing instruction (<?xml-model ... ?>) was introduced to decouple schema association from specific validation engines and namespaces. Its primary purposes include:

Syntax and Pseudo-Attributes

The <?xml-model?> instruction uses pseudo-attributes to specify the target schema and how processing tools should interpret it:

Example Implementation

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="schema/structure.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="schema/business-rules.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<document>
    <content>Valid XML instance</content>
</document>

In this implementation, modern XML editors and automated pipelines read the prolog instructions and apply both structural and rule-based validation sequentially, ensuring compliance across all defined standards.