Parsing MathML (original) (raw)
A.1 Use of MathML as Well-Formed XML
A MathML document must be a well-formed XML documents using elements in the MathML namespace as defined by this specification, however it is not required that the document refer to any specific Document Type Definition (DTD) or schema that specifies MathML. It is sometimes advantagous not to specify such a language definition as these files are large, often much larger than the MathML expression and unless they have been previously cached by the MathML application, the time taken to fetch the DTD or schema may have an appreciable effect on the processing of the MathML document.
Note also that if no DTD is specified with a DOCTYPE declaration, that entity references (for example to refer to MathML characters by name) may not be used. The document should be encoded in an encoding (for example UTF-8) in which all needed characters may be encoded as character data, or characters may be referenced using numeric character references, for example ∫ rather than ∫
If a MathML fragment is parsed without a DTD, in other words as a well-formed XML fragment, it is the responsibility of the processing application to treat the white space characters occurring outside of token elements as not significant.
However, in many circumstances, especially while producing or editing MathML, it is useful to use a language definition, to constrain the editing process or to check the correctness of generated files. The following section, Section A.2 Using the MathML DTD, discusses the MathML DTD, which forms a normative part of the specification. Following that, Section A.3 Using the MathML XML Schema, discusses an alternative language definition using the W3C XML schema language, [XMLSchemas]. One should note that the schema definition of the language is currently stricter than the DTD version. That is, a schema validating processor will declare invalid documents that are declared valid by a (DTD) validating XML parser. This is partly due to the fact that the XML schema language may express additional constraints not expressable in the DTD, and partly due to the fact that for reasons of compatibility with earlier releases, the DTD is intentionally forgiving in some places and does not enforce constraints that are specified in the text of this specification.
A.2 Using the MathML DTD
A.2.1 DOCTYPE declaration for MathML
MathML documents should be validated using the XML DTD for MathML,http://www.w3.org/Math/DTD/mathml2/mathml2.dtd, which is also shown below in Section A.2.5 The MathML DTD.
Documents using this DTD should contain a doctype declaration of the form:
The URI may be changed to that of a local copy of the DTD if required.
A.2.2 DTD Parameters
The MathML DTD has several parameter entities that may be used to customise the behaviour of the XML parser. In the examples below these parameter entites are shown being used in the internal subset of the DTD, i.e. within []
inside the<!DOCTYPE
declaration. If the MathML DTD is being used as a module in a larger document type, then these parameters entities may be set in the combined DTD and need not be explictly set in individual document instances. For example the combined XHTML + MathML DTD described below in Section A.2.3 MathML as a DTD Module sets each of these parameters to appropriate defaults.
A.2.2.1 Namespace Prefix
It is sometimes necessary, or convenient, to use the mechanisms described in [Modularization] which provide a namespace prefix on MathML element names. The DTD below is designed to allow this usage. If the parameter entity MATHML.prefixed
is declared to be INCLUDE, using a declaration such as
either in the internal subset of the DOCTYPE declaration, or in the DTD file that is including the MathML DTD, then all MathML elements should be used with a prefix, for example <m:mrow>
,<m:apply>
, etc. The prefix defaults to m
but another prefix may be declared by declaring in addition the parameter entity MathML.prefix
. For example,
would set the prefix for the MathML namespace to mml
.
So a complete declaration for a document using this prefix could be:
<!ENTITY % MATHML.prefix "mml">
]> mml:math ...
This use of parameter entities to control namespace prefixes follows the conventions specified in [Modularization].
In addition to the prefix for the MathML namespace, the DTD allows similar customization of other prefixes that may be used in attributes. The Xlink and W3C XML schema instance namespaces may be used with this DTD, with default prefixes xlink
and xsi
respectively. The entities XLINK.prefix
andSchema.prefix
may be set in the same way asMATHML.prefix
above to use different prefixes. As these namespaces are used for attribute names, they must be used with explict prefixes, so there is no analogue of theMATHML.prefixed
parameter in these cases. The following example uses the s:schemaLocation
attribute (which is described below in Section A.3.1 Associating the MathML schema with MathML fragments) with a non standard prefix, and uses a parameter entity in the internal subset of the DTD so that the file may be DTD valid as well as schema valid.
]>
...
Note that while the [Namespaces] Recommendation provides mechanisms to change the prefix at arbitrary points in the document, this flexibility is not provided in this DTD (and is probably not possible to specify in any DTD).
A.2.2.2 Additional DTD Checking
For reasons of backward compatibility, there are several constraints specified in this specification that are not enforced by the DTD by default. There are many constraints in the specification that may not be enforced by a DTD, however there are some additional constraints that could be checked. The parameter entity MathMLStrict
may be set to INCLUDE
to activate these stricter checks.
The syntax to set the parameter is as the same as for the previous examples:
]>
If this strict checking is enabled, the DTD will enforce thatmfrac
has exactly two child elements. Similarly formsub
, mover
, etc. The values of several attributes will be checked, for example the value ofmathvariant
is constrained to the list specified in Section 3.2.2 Mathematics style attributes common to token elements. The DTD will check that table makup, mtr
and mtd
, is only used correctly nested in mtable
. Finally the use of Presentation MathML elements within Content MathML is restricted to those elements listed in section Section 5.2.3 Presentation Markup Contained in Content Markup.
A.2.3 MathML as a DTD Module
Normally, however, a MathML expression does not constitute an entire XML document. MathML is designed to be used as the mathematics fragment of larger markup languages. In particular it is designed to be used as a module in documents marked up with the XHTML family of markup languages, as defined in[Modularization]. As a convenience, a version of theXHTML DTD, extended with this MathML module, is also provided as a concrete example. This version includes all the necessary declarations included into one file (in contrast to the standalone version of the MathML DTD which references several files for entity declarations etc.). To use this DTD, a document should contain the doctype declaration
as above, the URI may be altered to that of a local copy of the DTD, and the namespace prefixes used for XHTML and MathML may be controlled by the use of parameter entities.
A.2.4 SGML
If required, one may validate MathML documents using an SGML parser such as nsgmls
, rather than a validating XML parser. In this case an SGML declaration defining the constraints of XML applicable to an SGML parser must be used. See [sgml-xml].
A.2.5 The MathML DTD
The entity declarations for characters are referenced at the end of the DTD. These are linked to the character tables in Chapter 6 Characters, Entities and Fonts for each entity set.
Lists of the combined MathML set of character names, ordered byname or by Unicode value are also available.
In order to accommodate XML namespace prefixes, the DTD does not directly refer to an element name such as mrow
but instead always refers to the name via a parameter entity such as%mrow.qname;
. The definitions of these parameter entities are in the file but are not shown here. They are simply declarations such as the following, one for each MathML element.
Here we give the main body of the DTD. The full DTD, as well as the XHTML-Math DTD, is available as a gzipped tar archive.
<![%mathml-qname.module;[ %mathml-qname.mod;]]>
<![%NS.prefixed;[ <!ENTITY % MATHML.NamespaceDecl.attrib "%NamespaceDecl.attrib;"
]]> <!ENTITY % MATHML.NamespaceDecl.attrib "%MATHML.xmlns.attrib;"
<![%MathMLstrict;[ ]]>
<![%MathMLstrict;[ ]]> <![%MathMLstrict;[ ]]> <![%MathMLstrict;[ ]]> <![%MathMLstrict;[ ]]>
<![%MathMLstrict;[ ]]>
<!ATTLIST %mi.qname; %MATHML.Common.attrib; %att-fontinfo;
<!ATTLIST %mn.qname;
%MATHML.Common.attrib;
%att-fontinfo;
<!ATTLIST %mo.qname;
%MATHML.Common.attrib;
%att-fontinfo;
%att-opinfo;
<!ATTLIST %mtext.qname;
%MATHML.Common.attrib;
%att-fontinfo;
<!ATTLIST %ms.qname;
%MATHML.Common.attrib;
%att-fontinfo;
%att-lquote;
%att-rquote;
<!ELEMENT %mspace.qname; EMPTY >
<!ATTLIST %mspace.qname; %att-sizeinfo; %att-linebreak; %MATHML.Common.attrib;
<!ATTLIST %mrow.qname;
%MATHML.Common.attrib;
<!ATTLIST %mfrac.qname;
%MATHML.Common.attrib;
%att-bevelled;
%att-numalign;
%att-denomalign;
%att-linethickness;
<!ATTLIST %msqrt.qname;
%MATHML.Common.attrib;
<!ATTLIST %menclose.qname;
%MATHML.Common.attrib;
notation CDATA 'longdiv' >
<!ATTLIST %mroot.qname;
%MATHML.Common.attrib;
<!ATTLIST %mstyle.qname;
%MATHML.Common.attrib;
%att-fontinfo;
%att-opinfo;
%att-lquote;
%att-rquote;
%att-linethickness;
%att-scriptlevel;
%att-scriptsizemultiplier;
%att-scriptminsize;
%att-background;
%att-veryverythinmathspace;
%att-verythinmathspace;
%att-thinmathspace;
%att-mediummathspace;
%att-thickmathspace;
%att-verythickmathspace;
%att-veryverythickmathspace;
%att-open;
%att-close;
%att-separators;
%att-subscriptshift;
%att-superscriptshift;
%att-accentunder;
%att-tableinfo;
%att-rowspan;
%att-columnspan;
%att-edge;
%att-selection;
%att-bevelled;
%att-height;
%att-depth;
<!ATTLIST %merror.qname;
%MATHML.Common.attrib;
<!ATTLIST %mpadded.qname;
%MATHML.Common.attrib;
%att-sizeinfo;
%att-lspace;
<!ATTLIST %mphantom.qname;
%MATHML.Common.attrib;
<!ATTLIST %mfenced.qname;
%MATHML.Common.attrib;
%att-open;
%att-close;
%att-separators;
<!ATTLIST %msub.qname;
%MATHML.Common.attrib;
%att-subscriptshift;
<!ATTLIST %msup.qname;
%MATHML.Common.attrib;
%att-superscriptshift;
<!ATTLIST %msubsup.qname;
%MATHML.Common.attrib;
%att-subscriptshift;
%att-superscriptshift;
<!ATTLIST %munder.qname;
%MATHML.Common.attrib;
%att-accentunder;
<!ATTLIST %mover.qname;
%MATHML.Common.attrib;
%att-accent;
<!ATTLIST %munderover.qname;
%MATHML.Common.attrib;
%att-accent;
%att-accentunder;
<!ATTLIST %mmultiscripts.qname;
%MATHML.Common.attrib;
%att-subscriptshift;
%att-superscriptshift;
<!ELEMENT %mprescripts.qname; EMPTY >
<!ATTLIST %mprescripts.qname;
%MATHML.xmlns.attrib; >
<!ELEMENT %none.qname; EMPTY >
<!ATTLIST %none.qname;
%MATHML.xmlns.attrib; >
<![%MathMLstrict;[
]]>
<!ATTLIST %mtable.qname; %MATHML.Common.attrib; %att-tableinfo;
<!ATTLIST %mtr.qname;
%MATHML.Common.attrib;
%att-rowalign;
%att-columnalign-list;
%att-groupalign-list;
<!ATTLIST %mlabeledtr.qname;
%MATHML.Common.attrib;
%att-rowalign;
%att-columnalign-list;
%att-groupalign-list;
<!ATTLIST %mtd.qname;
%MATHML.Common.attrib;
%att-rowalign;
%att-columnalign;
%att-groupalign-list;
%att-rowspan;
%att-columnspan;
<!ELEMENT %malignmark.qname; EMPTY >
<!ATTLIST %malignmark.qname;
%att-edge; >
<!ELEMENT %maligngroup.qname; EMPTY >
<!ATTLIST %maligngroup.qname;
%MATHML.Common.attrib;
%att-groupalign;
<!ELEMENT %mglyph.qname; EMPTY >
<!ATTLIST %mglyph.qname;
%att-alt;
%att-fontfamily;
%att-index; >
<!ATTLIST %maction.qname;
%MATHML.Common.attrib;
%att-actiontype;
%att-selection;
<![%MathMLstrict;[
]]>
<!ATTLIST %ci.qname;
%MATHML.Common.attrib;
%att-type;
%att-definition;
%att-encoding;
<!ATTLIST %csymbol.qname;
%MATHML.Common.attrib;
%att-encoding;
%att-type;
%att-definition;
<!ATTLIST %cn.qname;
%MATHML.Common.attrib;
%att-type;
%att-base;
%att-definition;
%att-encoding;
<!ATTLIST %apply.qname;
%MATHML.Common.attrib;
<!ATTLIST %reln.qname;
%MATHML.Common.attrib;
<!ATTLIST %lambda.qname;
%MATHML.Common.attrib;
<!ATTLIST %condition.qname;
%MATHML.Common.attrib;
<!ATTLIST %declare.qname;
%MATHML.Common.attrib;
%att-type;
%att-scope;
%att-nargs;
%att-occurrence;
%att-definition;
%att-encoding;
<!ELEMENT %sep.qname; EMPTY >
<!ATTLIST %sep.qname;
%MATHML.xmlns.attrib; >
<![%MathMLstrict;[
]]>
<!ATTLIST %semantics.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ATTLIST %annotation.qname;
%MATHML.Common.attrib;
%att-encoding;
<!ATTLIST %annotation-xml.qname; %MATHML.Common.attrib; %att-encoding;
<!ATTLIST %interval.qname;
%MATHML.Common.attrib;
%att-closure;
<!ATTLIST %set.qname;
%MATHML.Common.attrib;
%att-type;
<!ATTLIST %list.qname;
%MATHML.Common.attrib;
%att-order;
<!ATTLIST %vector.qname;
%MATHML.Common.attrib;
<!ATTLIST %matrix.qname;
%MATHML.Common.attrib;
<!ATTLIST %matrixrow.qname;
%MATHML.Common.attrib;
<!ATTLIST %piecewise.qname;
%MATHML.Common.attrib;
<!ATTLIST %piece.qname;
%MATHML.Common.attrib;
<!ATTLIST %otherwise.qname;
%MATHML.Common.attrib;
<!ELEMENT %integers.qname; EMPTY >
<!ATTLIST %integers.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %reals.qname; EMPTY >
<!ATTLIST %reals.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %rationals.qname; EMPTY >
<!ATTLIST %rationals.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %naturalnumbers.qname; EMPTY >
<!ATTLIST %naturalnumbers.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %complexes.qname; EMPTY >
<!ATTLIST %complexes.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %primes.qname; EMPTY >
<!ATTLIST %primes.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %exponentiale.qname; EMPTY >
<!ATTLIST %exponentiale.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %imaginaryi.qname; EMPTY >
<!ATTLIST %imaginaryi.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %notanumber.qname; EMPTY >
<!ATTLIST %notanumber.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %true.qname; EMPTY >
<!ATTLIST %true.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %false.qname; EMPTY >
<!ATTLIST %false.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %emptyset.qname; EMPTY >
<!ATTLIST %emptyset.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %pi.qname; EMPTY >
<!ATTLIST %pi.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %eulergamma.qname; EMPTY >
<!ATTLIST %eulergamma.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %infinity.qname; EMPTY >
<!ATTLIST %infinity.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %inverse.qname; EMPTY >
<!ATTLIST %inverse.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %domain.qname; EMPTY >
<!ATTLIST %domain.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %codomain.qname; EMPTY >
<!ATTLIST %codomain.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %image.qname; EMPTY >
<!ATTLIST %image.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ATTLIST %fn.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %ident.qname; EMPTY >
<!ATTLIST %ident.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %compose.qname; EMPTY >
<!ATTLIST %compose.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %exp.qname; EMPTY >
<!ATTLIST %exp.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %abs.qname; EMPTY >
<!ATTLIST %abs.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %arg.qname; EMPTY >
<!ATTLIST %arg.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %real.qname; EMPTY >
<!ATTLIST %real.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %imaginary.qname; EMPTY >
<!ATTLIST %imaginary.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %conjugate.qname; EMPTY >
<!ATTLIST %conjugate.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %factorial.qname; EMPTY >
<!ATTLIST %factorial.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %floor.qname; EMPTY >
<!ATTLIST %floor.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %ceiling.qname; EMPTY >
<!ATTLIST %ceiling.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %minus.qname; EMPTY >
<!ATTLIST %minus.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %quotient.qname; EMPTY >
<!ATTLIST %quotient.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %divide.qname; EMPTY >
<!ATTLIST %divide.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %power.qname; EMPTY >
<!ATTLIST %power.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %rem.qname; EMPTY >
<!ATTLIST %rem.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %plus.qname; EMPTY >
<!ATTLIST %plus.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %max.qname; EMPTY >
<!ATTLIST %max.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %min.qname; EMPTY >
<!ATTLIST %min.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %times.qname; EMPTY >
<!ATTLIST %times.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %gcd.qname; EMPTY >
<!ATTLIST %gcd.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %lcm.qname; EMPTY >
<!ATTLIST %lcm.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %root.qname; EMPTY >
<!ATTLIST %root.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %exists.qname; EMPTY >
<!ATTLIST %exists.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %forall.qname; EMPTY >
<!ATTLIST %forall.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %and.qname; EMPTY >
<!ATTLIST %and.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %or.qname; EMPTY >
<!ATTLIST %or.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %xor.qname; EMPTY >
<!ATTLIST %xor.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %not.qname; EMPTY >
<!ATTLIST %not.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %implies.qname; EMPTY >
<!ATTLIST %implies.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %divergence.qname; EMPTY >
<!ATTLIST %divergence.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %grad.qname; EMPTY >
<!ATTLIST %grad.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %curl.qname; EMPTY >
<!ATTLIST %curl.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %laplacian.qname; EMPTY >
<!ATTLIST %laplacian.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %log.qname; EMPTY >
<!ATTLIST %log.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %int.qname; EMPTY >
<!ATTLIST %int.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %diff.qname; EMPTY >
<!ATTLIST %diff.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %partialdiff.qname; EMPTY >
<!ATTLIST %partialdiff.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %ln.qname; EMPTY >
<!ATTLIST %ln.qname;
%MATHML.Common.attrib;
%att-definition;
%att-encoding;
<!ELEMENT %card.qname; EMPTY > <!ATTLIST %card.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %setdiff.qname; EMPTY > <!ATTLIST %setdiff.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %union.qname; EMPTY > <!ATTLIST %union.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %intersect.qname; EMPTY > <!ATTLIST %intersect.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %cartesianproduct.qname; EMPTY > <!ATTLIST %cartesianproduct.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %sum.qname; EMPTY > <!ATTLIST %sum.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %product.qname; EMPTY > <!ATTLIST %product.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %limit.qname; EMPTY > <!ATTLIST %limit.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %sin.qname; EMPTY > <!ATTLIST %sin.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %cos.qname; EMPTY > <!ATTLIST %cos.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %tan.qname; EMPTY > <!ATTLIST %tan.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %sec.qname; EMPTY > <!ATTLIST %sec.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %csc.qname; EMPTY > <!ATTLIST %csc.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %cot.qname; EMPTY > <!ATTLIST %cot.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %sinh.qname; EMPTY > <!ATTLIST %sinh.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %cosh.qname; EMPTY > <!ATTLIST %cosh.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %tanh.qname; EMPTY > <!ATTLIST %tanh.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %sech.qname; EMPTY > <!ATTLIST %sech.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %csch.qname; EMPTY > <!ATTLIST %csch.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %coth.qname; EMPTY > <!ATTLIST %coth.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arcsin.qname; EMPTY > <!ATTLIST %arcsin.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arccos.qname; EMPTY > <!ATTLIST %arccos.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arctan.qname; EMPTY > <!ATTLIST %arctan.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arccosh.qname; EMPTY > <!ATTLIST %arccosh.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arccot.qname; EMPTY > <!ATTLIST %arccot.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arccoth.qname; EMPTY > <!ATTLIST %arccoth.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arccsc.qname; EMPTY > <!ATTLIST %arccsc.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arccsch.qname; EMPTY > <!ATTLIST %arccsch.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arcsec.qname; EMPTY > <!ATTLIST %arcsec.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arcsech.qname; EMPTY > <!ATTLIST %arcsech.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arcsinh.qname; EMPTY > <!ATTLIST %arcsinh.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %arctanh.qname; EMPTY > <!ATTLIST %arctanh.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %mean.qname; EMPTY > <!ATTLIST %mean.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %sdev.qname; EMPTY > <!ATTLIST %sdev.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %variance.qname; EMPTY > <!ATTLIST %variance.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %median.qname; EMPTY > <!ATTLIST %median.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %mode.qname; EMPTY > <!ATTLIST %mode.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %moment.qname; EMPTY > <!ATTLIST %moment.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %determinant.qname; EMPTY > <!ATTLIST %determinant.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %transpose.qname; EMPTY > <!ATTLIST %transpose.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %vectorproduct.qname; EMPTY > <!ATTLIST %vectorproduct.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %scalarproduct.qname; EMPTY > <!ATTLIST %scalarproduct.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %outerproduct.qname; EMPTY > <!ATTLIST %outerproduct.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %selector.qname; EMPTY > <!ATTLIST %selector.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %neq.qname; EMPTY > <!ATTLIST %neq.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %factorof.qname; EMPTY > <!ATTLIST %factorof.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %eq.qname; EMPTY > <!ATTLIST %eq.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %equivalent.qname; EMPTY > <!ATTLIST %equivalent.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %approx.qname; EMPTY > <!ATTLIST %approx.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %gt.qname; EMPTY > <!ATTLIST %gt.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %lt.qname; EMPTY > <!ATTLIST %lt.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %geq.qname; EMPTY > <!ATTLIST %geq.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %leq.qname; EMPTY > <!ATTLIST %leq.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %in.qname; EMPTY > <!ATTLIST %in.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %notin.qname; EMPTY > <!ATTLIST %notin.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %notsubset.qname; EMPTY > <!ATTLIST %notsubset.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %notprsubset.qname; EMPTY > <!ATTLIST %notprsubset.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %subset.qname; EMPTY > <!ATTLIST %subset.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %prsubset.qname; EMPTY > <!ATTLIST %prsubset.qname; %MATHML.Common.attrib; %att-definition; %att-encoding;
<!ELEMENT %tendsto.qname; EMPTY > <!ATTLIST %tendsto.qname; %MATHML.Common.attrib; %att-definition; %att-encoding; %att-type;
<!ATTLIST %lowlimit.qname; %MATHML.Common.attrib;
<!ATTLIST %uplimit.qname; %MATHML.Common.attrib;
<!ATTLIST %bvar.qname; %MATHML.Common.attrib;
<!ATTLIST %degree.qname; %MATHML.Common.attrib;
<!ATTLIST %logbase.qname; %MATHML.Common.attrib;
<!ATTLIST %momentabout.qname; %MATHML.Common.attrib;
<!ATTLIST %domainofapplication.qname; %MATHML.Common.attrib;
<![%MathMLstrict;[
]]>
<!ELEMENT %ci.qname; (%MathMLCharacters; | %PresInCont;)* > <!ELEMENT %csymbol.qname; (%MathMLCharacters; | %PresInCont;)* > <!ELEMENT %cn.qname; (%MathMLCharacters; | %sep.qname; | %PresInCont;)* >
<!ELEMENT %apply.qname; (%ContentExpression;) > <!ELEMENT %reln.qname; (%ContentExpression;) > <!ELEMENT %lambda.qname; (%ContentExpression;) >
<!ELEMENT %condition.qname; (%ContentExpression;) > <!ELEMENT %declare.qname; (%ContentExpression;) >
<!ELEMENT %semantics.qname; (%semanticsContentExpression;) > <!ELEMENT %annotation.qname; %Annotation.content; >
<!ELEMENT %annotation-xml.qname; %Annotation-xml.content; >
<!ELEMENT %interval.qname; (%ContentExpression;) > <!ELEMENT %set.qname; (%ContentExpression;) > <!ELEMENT %list.qname; (%ContentExpression;) > <!ELEMENT %vector.qname; (%ContentExpression;) > <!ELEMENT %matrix.qname; (%ContentExpression;) > <!ELEMENT %matrixrow.qname; (%ContentExpression;) >
<!ELEMENT %piecewise.qname; ((%piece.qname;)*, (%otherwise.qname;)? ) > <!ELEMENT %piece.qname; (%ContentExpression;) > <!ELEMENT %otherwise.qname; (%ContentExpression;) >
<!ELEMENT %fn.qname; (%ContentExpression;) >
<!ELEMENT %lowlimit.qname; (%ContentExpression;) > <!ELEMENT %uplimit.qname; (%ContentExpression;) > <!ELEMENT %bvar.qname; (%ContentExpression;) > <!ELEMENT %degree.qname; (%ContentExpression;) > <!ELEMENT %logbase.qname; (%ContentExpression;) > <!ELEMENT %momentabout.qname; (%ContentExpression;) > <!ELEMENT %domainofapplication.qname; (%ContentExpression;) >
<![%MathMLstrict;[
]]>
<!ELEMENT %mstyle.qname; (%PresExpression;) > <!ELEMENT %merror.qname; (%PresExpression;) > <!ELEMENT %mphantom.qname; (%PresExpression;) > <!ELEMENT %mrow.qname; (%PresExpression;) > <!ELEMENT %mfrac.qname; (%twoPresExpression;) > <!ELEMENT %msqrt.qname; (%PresExpression;) > <!ELEMENT %menclose.qname; (%PresExpression;) > <!ELEMENT %mroot.qname; (%twoPresExpression;) > <!ELEMENT %msub.qname; (%twoPresExpression;) > <!ELEMENT %msup.qname; (%twoPresExpression;) > <!ELEMENT %msubsup.qname; (%threePresExpression;) > <!ELEMENT %mmultiscripts.qname; (%prscrPresExpression;) > <!ELEMENT %munder.qname; (%twoPresExpression;) > <!ELEMENT %mover.qname; (%twoPresExpression;) > <!ELEMENT %munderover.qname; (%threePresExpression;) > <!ELEMENT %mtable.qname; (%mtrPresExpression;) > <!ELEMENT %mtr.qname; (%mtdPresExpression;) > <!ELEMENT %mlabeledtr.qname; (%mtdPresExpression;) > <!ELEMENT %mtd.qname; (%PresExpression;) > <!ELEMENT %maction.qname; (%PresExpression;) > <!ELEMENT %mfenced.qname; (%PresExpression;) > <!ELEMENT %mpadded.qname; (%PresExpression;) >
<!ELEMENT %mi.qname; (%MathMLCharacters; | %malignmark.qname;)* > <!ELEMENT %mn.qname; (%MathMLCharacters; | %malignmark.qname;)* > <!ELEMENT %mo.qname; (%MathMLCharacters; | %malignmark.qname;)* > <!ELEMENT %mtext.qname; (%MathMLCharacters; | %malignmark.qname;)* > <!ELEMENT %ms.qname; (%MathMLCharacters; | %malignmark.qname;)* >
<![%MathMLstrict;[ ]]>
<!ELEMENT %math.qname; (%MathExpression;) >
<!ATTLIST %math.qname; %att-topinfo; %att-browif; >
]]>A.3 Using the MathML XML Schema
MathML fragments can be validated using the XML Schema for MathML, located at http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd. The provided schema allows checking a MathML fragment in a stricter way than by performing DTD validation, in particular constrained attribute values such as linethickness are enforced by the schema. Additionally, XML Schemas have the advantage over DTDs of supporting the XML namespaces mechanism. Thus a MathML fragment can declare any namespace prefix (and possibly more than one), without the requirement that the author indicate it using a parameter entity, as described above.
In its current version the schema does not declare deprecated markup such as the fn
element, so documents using such deprecated features will be declared invalid.
A.3.1 Associating the MathML schema with MathML fragments
Similarly to the DOCTYPE declaration used in documents, it is possible to link a MathML fragment to the XML Schema, as shown below.
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/1998/Math/MathML " title="undefined" rel="noopener noreferrer">http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd"> ...
The xsi:schemaLocation
attribute belongs to the XML Schema instance namespace, defined in [XMLSchemas]. The value of the attribute is a pair of URIs: the first is the MathML namespace URI and the second is the location of the schema for that namespace. The second URI may be changed to that of a local copy if required.
As the XML Schema specification indicates, the use of theschemaLocation
attribute is only a hint for schema processors: validation by a MathML-aware processor can be performed without requiring that the schemaLocation
attribute be declared in the instance. Moreover, a processor can even ignore or override the specified schema URI, if it is directed to.
Note that the file mathml.xsd
at the URI given above is only the main body of the schema, and is one of many files that constitute the MathML XML Schema. However the complete set of files is available as a gzipped tar archive for local use.
A.3.2 Character entity references
Although validating a MathML fragment with the XML Schema provided performs more checks regarding the structure of the fragment than the DTD, DTD processing is still necessary if the MathML markup contains entity references for characters and symbols, as XML Schema does not provide a mechanism for expanding named entities. Therefore the MathML DOCTYPE declaration must still be present if one wishes to use entities for mathematical symbols, such asⅆ
. An example of a MathML document linking to both the MathML DTD and the XML Schema is shown below.
<!ENTITY % MATHML.prefix "mml">
]>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/1998/Math/MathML " title="undefined" rel="noopener noreferrer">http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd"> ... mml:mo ⅆ ...
The use of character references to represent characters and symbols, such as ⅆ
(which is equivalentto ⅆ
) does not necessitate the use of a DOCTYPE declaration.