8 MathML用の文書オブジェクトモデル(DOM)

概要: 数学用マークアップ言語 (MathML) バージョン 2.0
前: 7 MathML のインターフェース
次: A MathML のパース
 
8 MathML 用の文書オブジェクトモデル(DOM)
   8.1 導入
      8.1.1 hasFeature 文字列
      8.1.2 MathML DOM 拡張

8.1 導入

この文書は、DOM 第2水準の Core API を拡張するもので、 文書中における MathML 要素に独特なオブジェクトおよびメソッドを解説するものです。 階層化された文書構造、要素、および属性を操作するために必要な基本的な機能性については、Core APIの文書にあります; この文書では、MathML で定義された特殊な要素に依存する機能性について述べています。

実際の DOM 仕様については、付録 D「MathML用の文書オブジェクトモデル(DOM)」 を参照してください。

MathML独自のDOM APIの目的は:

この文書では、MathML 用に以下のような特別化を行いました:

Where no special convenience methods are provided for retrieving attributes or child Nodes, the basic functionality of the Core DOM should be used to retrieve them.

MathML specifies rules that are invisible to generic XML processors and validators. The fact that MathML DOM objects are required to respect these rules, and to throw exceptions when those rules are violated, is an important reason for providing a MathML-specific DOM extension.

There are basically two kinds of additional MathML grammar and syntax rules. One kind involves placing additional criteria on attribute values. For example, it is not possible in pure XML to require that an attribute value be a positive integer. The second kind of rule specifies more detailed restrictions on the child elements (for example on ordering) than are given in the DTD. For example, it is not possible in XML to specify that the first child be interpreted one way, and the second in another. The MathML DOM objects are required to provide this interpretation.

MathML ignores whitespace occurring outside token elements. Non-whitespace characters are not allowed there. Whitespace occurring within the content of token elements is `trimmed' from the ends (i.e. all whitespace at the beginning and end of the content is removed), and `collapsed' internally (i.e. each sequence of 1 or more whitespace characters is replaced with one blank character). The MathML DOM elements perform this whitespace trimming as necessary. In MathML, as in XML, `whitespace' means blanks, tabs, newlines, or carriage returns, i.e. characters with hexadecimal Unicode codes U+0020, U+0009, U+000a, or U+000d, respectively.

8.1.1 hasFeature String

Support for the MathML Document Object Model may be queried by calling the DOMImplementation::hasFeature method with the test string "org.w3c.dom.mathml".

8.1.2 MathML DOM Extensions

It is expected that a future version of the MathML DOM may deal with issues which are not resolved here. Some of these are described here.

8.1.2.1 Traversal and Range Interfaces

It is likely that a need will become obvious for MathML-specific specializations of interfaces belonging to the Traversal and Range Modules of the Document Object Model Level 2. The order of traversal of bound variables, conditions, and declarations - or whether they should be omitted from a given traversal altogether - offers an example of a potential utility for such specializations. However, it would be premature to specify any such interfaces at this time. Implementation experience will be necessary in order to discover the appropriate interfaces which should be specified.

8.1.2.2 Embedding Issues

The interaction between the Document Object Model representing specialized XML markup (such as MathML) embedded inside other types of XML markup (such as XHTML) and that representing the host document is as yet undefined. If and when such interactions are specified, we hope that implementors will be able to use them to enhance the usefulness of the MathML Document Object Model.

It may be necessary, however, to add some interface definitions to the MathML Document Object Model in order to make this possible. If so, we hope to be able to do this at some future time.

概要: 数学用マークアップ言語 (MathML) バージョン 2.0
前: 7 MathMLのインターフェイス
次: A MathMLのパース