Schema languages for technical documentation
Schema languages define rules for XML documents and describe the structure and content of these documents syntactically. The defined set of rules ensures that the XML document is valid, meaning it consists of correct, consistent, and machine-readable information units.
There are grammar-based and rule-based schema languages, with DTD, XML Schema, and Relax NG being examples of grammar-based schema languages. They allow the definition of elements, attributes, and data types, determining the order, frequency, and hierarchy in which elements can be used. On the other hand, Schematron is a rule-based schema language that allows the formulation of additional conventions that complement the grammatical rules of an XML application.
A Document Type Definition (DTD) is a set of rules that describe the logical structure of a document, including elements, attributes, entities, and notations. DTD specifies the order, arrangement, and type of content. The level of detail and semantics is determined by the number and quality of elements. DTD is the most widely used syntax for document types.
XML Schema (XSD – XML Schema Definition) is also used to define structures in XML documents. Unlike DTD, XML Schema describes the structure itself as an XML document. XML Schema is primarily designed for exchange between applications (e.g., web services) and data-intensive workflows. On the other hand, DTDs are more suitable for text-based applications.
What differentiates XML Schema from a DTD?
– XML Schema supports the use and creation of data types for elements and attributes, which can be complemented by integrity conditions and additional cardinalities.
– XML Schema supports namespaces (collections of elements and attributes identified by an IRI) to avoid conflicts when using multiple vocabularies. DTDs can only be combined if no naming conflicts exist.
– XML Schema is written in XML syntax itself and can be easily validated by an XML parser, while DTDs require their own parser due to their own syntax.
– XML Schema allows the definition of inheritance hierarchies.
– XML Schema makes it straightforward to define unordered structures.
– XML Schema can specify more semantics than DTDs.
With these extensions, XML Schema is more powerful and expressive compared to a DTD, especially for data description. While an equivalent XML Schema can be created for each DTD, the reverse is not necessarily possible.
Regular Language Description for XML New Generation (RELAX NG) is also a schema language for defining the structure of XML documents and is an international standard ISO/IEC 1975-2 within the Document Schema Definition Language. Like XML Schema, RELAX NG also uses XML-based vocabulary instead of its own syntax, providing a more powerful alternative to DTD and a less complex alternative to XML Schema for validating elements and attributes in XML documents. RELAX NG was created to eliminate the drawbacks of DTD and XML Schema, aiming to use XML syntax and be lightweight, which it has achieved.
Schematron is a schema language that does not use formal grammar and is not used for definition (like DTD and XML Schema) but rather for validation of XML documents. It defines rules that are not possible with grammar-based schema languages. Since May 2006, Schematron 1.6 has been an official ISO/IEC standard. Schematron complements traditional schema languages and is now supported by common XML editors. For example, the Oxygen Editor provides a Schematron Quick Fix functionality that automatically detects and corrects rule violations.
To learn more about the application and practical use of schema languages, refer to our Whitepaper.
DTD & Schematron vs. XML Schema
We provide you with an insight into various schema languages and categorize the different terms. We address the question of whether there is a suitable schema language for technical documentation and illustrate two practical examples that showcase different scenarios for the application of schema languages and the use of Schematron for validation.
Subscribe to the free newsletter from PANTOPIX.
We will gladly keep you informed regularly about new articles.
We wonder how far VR and AR are already operational and whether the trend will prevail and revolutionize technical documentation.
Senior Marketing Manager