2006 | OriginalPaper | Buchkapitel
Validating OMDoc Documents
verfasst von : Michael Kohlhase
Erschienen in: OMDoc – An Open Markup Format for Mathematical Documents [version 1.2]
Verlag: Springer Berlin Heidelberg
Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.
Wählen Sie Textabschnitte aus um mit Künstlicher Intelligenz passenden Patente zu finden. powered by
Markieren Sie Textabschnitte, um KI-gestützt weitere passende Inhalte zu finden. powered by
In Chapter 1 we have briefly discussed the basics of validating XML documents by document type definitions (DTDs) and schemata. In this chapter, we will instantiate this discussion with the particulars of validating
OMDoc
documents.
Generally, DTDs and schemata are context-free grammars for trees, that can be used by a
validating parser
to reject XML documents that do not conform to the constraints expressed in the
OMDoc
DTD or schemata discussed here.
Note that none of these grammars can enforce all constraints that the
OMDoc
specification in Part III of this book imposes on documents. Therefore grammar-based validation is only a necessary condition for
OMDoc
-
validity
. Still,
OMDoc
documents should be validated to ensure proper function of
OMDoc
tools, such as the ones discussed in Chapters 25 and 26. Validation against multiple grammars gives the best results. With the current state of validation technology, there is no clear recommendation, which of the validation approaches to prefer for
OMDoc
. DTD validation is currently best supported by standard XML applications and supports default values for attributes. This allows the author who writes
OMDoc
documents by hand to elide implicit attributes and make the marked-up text more readable. XML- and
RelaxNG
schema validation have the advantage that they are namespace-aware and support more syntactic constraints. Neither of these support mnemonic XML entities, such as the ones used for
Unicode
characters in Presentation-
MathML
, so that these have to be encoded as
Unicode
code points. Finally
RelaxNG
schemata do not fully support default values for attributes, so that
OMDoc
documents have to be normalized to be
RelaxNG
-valid.
We will now discuss the particulars of the respective validation formats. As the
RelaxNG
schema is the most expressive and readable for humans we consider it as the normative grammar formalism for
OMDoc
, and have included it in Appendix D for reference.