Using both RELAX NG & Schematron for validation
✓ Published0🌍 Public
CCliffordAnderson
Last edited May 26, 2014
Created on May 26, 2014
This example shows how RELAX NG and Schematron can be combined to validate a single XML document, using a compact schema (`book.rnc`) for structural rules and a Schematron schema (`book.sch`) for additional business-logic checks. The XML file (`book.xml`) references both validation engines via `xml-model` processing instructions. The RELAX NG schema defines element and attribute patterns, including regular-expression constraints for the author and title attributes. The Schematron schema adds rule-based assertions, such as requiring an `authorized` attribute and verifying the publication date is a valid `xs:gYear`. The sample book data contains a deliberate error—an invalid `authorized` attribute—to trigger a diagnostic message.
AI-generated description