File: chapter8.html

package info (click to toggle)
w3-recs 20080716-1
  • links: PTS, VCS
  • area: non-free
  • in suites: lenny, squeeze
  • size: 129,080 kB
  • ctags: 41,279
  • sloc: xml: 35,257; makefile: 78; sh: 63; perl: 31
file content (264 lines) | stat: -rw-r--r-- 12,983 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   
      <title>Document Object Model for MathML</title><style type="text/css">
code           { font-family: monospace; }

div.constraint,
div.issue,
div.note,
div.notice     { margin-left: 2em; }

li p           { margin-top: 0.3em;
                 margin-bottom: 0.3em; }

div.exampleInner pre { margin-left: 1em;
                       margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
                  margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
                   border-top-width: 4px;
                   border-top-style: double;
                   border-top-color: #d3d3d3;
                   border-bottom-width: 4px;
                   border-bottom-style: double;
                   border-bottom-color: #d3d3d3;
                   padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
                    margin: 4px}
a.mainindex {font-weight: bold;}
li.sitem {list-style-type: none;}

  .error { color: red }
  .minitoc { border-style: solid;
             border-color: #0050B2; 
             border-width: 1px ;
             padding: 0.3em;}
  .attention { border-style: solid; 
               border-width: 1px ; 
               color: #5D0091;
               background: #F9F5DE; 
               border-color: red;
               margin-left: 1em;
               margin-right: 1em;
               margin-top: 0.25em;
               margin-bottom: 0.25em; }

  .attribute-Name { background: #F9F5C0; }
  .method-Name { background: #C0C0F9; }
  .IDL-definition { border-style: solid; 
               border-width: 1px ; 
               color: #001000;
               background: #E0FFE0; 
               border-color: #206020;
               margin-left: 1em;
               margin-right: 1em;
               margin-top: 0.25em;
               margin-bottom: 0.25em; }
  .baseline {vertical-align: baseline}

  #eqnoc1 {width: 10%}
  #eqnoc2 {width: 80%; text-align: center; }
  #eqnoc3 {width: 10%; text-align: right; }

div.div1 {margin-bottom: 1em;}
          
.h3style {
  text-align: left;
  font-family: sans-serif;
  font-weight: normal;
  color: #0050B2; 
  font-size: 125%;
}

  h4 { text-align: left;
       font-family: sans-serif;
       font-weight: normal;
       color: #0050B2; }
  h5 { text-align: left;
       font-family: sans-serif;
       font-weight: bold;
       color: #0050B2; } 

  th {background:  #E0FFE0;}

  p, blockquote, h4 { font-family: sans-serif; }
  dt, dd, dl, ul, li { font-family: sans-serif; }
  pre, code { font-family: monospace }




.mathml-render {
font-family: serif;
font-size: 130%;
border: solid 4px green;
padding-left: 1em;
padding-right: 1em;
}
</style><link rel="stylesheet" type="text/css" href="../../../StyleSheets/TR/W3C-REC.css">
   </head>
   <body>
      
      <h1><a name="dom-intro" id="dom-intro"></a>8 Document Object Model for MathML
      </h1>
      <!-- TOP NAVIGATION BAR -->
      <div class="minitoc">
         
           Overview: <a href="overview.html">Mathematical Markup Language (MathML) Version 2.0 (Second Edition)</a><br>
           Previous: 7 <a href="chapter7.html">The MathML Interface</a><br>
           Next: A <a href="appendixa.html">Parsing MathML</a><br><br>8 <a href="chapter8.html">Document Object Model for MathML</a><br>&nbsp;&nbsp;&nbsp;&nbsp;8.1 <a href="chapter8.html#dom-intro.intro">Introduction</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8.1.1 <a href="chapter8.html#id.8.1.1">hasFeature String</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8.1.2 <a href="chapter8.html#id.8.1.2">MathML DOM Extensions</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8.1.2.1 <a href="chapter8.html#id.8.1.2.1">Traversal and Range Interfaces</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8.1.2.2 <a href="chapter8.html#id.8.1.2.2">Embedding Issues</a><br></div>
      <div class="div1">
         <div class="div2">
            
            <h2><a name="dom-intro.intro" id="dom-intro.intro"></a>8.1 Introduction
            </h2>
            <p>This document extends the Core API of the DOM Level 2 to describe
               objects and methods specific to MathML elements in documents. The
               functionality needed to manipulate basic hierarchical document structures,
               elements, and attributes will be found in the core document; functionality
               that depends on the specific elements defined in MathML will be found in
               this document.
            </p>
            <p>The actual DOM specification appears in  <a href="appendixd.html">Appendix&nbsp;D Document Object Model for MathML</a>.
            </p>
            <p>The goals of the MathML-specific DOM API are:</p>
            <ul>
               <li>
                  <p>To specialize and add functionality that relates specifically to
                     MathML elements.
                  </p>
               </li>
               <li>
                  <p>To provide convenience mechanisms, where appropriate, for common
                     and frequent operations on MathML elements.
                  </p>
               </li>
            </ul>
            <p>This document includes the following specializations for
               MathML:
               
            </p>
            <ul>
               <li>
                  <p>A <code>MathMLElement</code> interface derived from the core
                     interface <code>Element</code>.  MathMLElement specifies the operations and
                     queries that can be made on any MathML element. Methods on
                     <code>MathMLElement</code> include those for the retrieval and modification
                     of attributes that apply to all MathML elements.
                  </p>
               </li>
               <li>
                  <p>Various specializations of <code>MathMLElement</code> to encode 
                     syntactical restrictions imposed by MathML.
                  </p>
               </li>
               <li>
                  <p>Specializations of <code>MathMLElement</code> representing all 
                     MathML elements with attributes extending beyond those specified in the 
                     <code>MathMLElement</code> interface. For all such attributes, the derived 
                     interface for the element contains explicit methods for setting and getting 
                     the values.
                  </p>
               </li>
               <li>
                  <p>Special methods for insertion and retrieval of children of MathML
                     elements.  While the basic methods inherited from the <code>Node</code> and
                     <code>Element</code> interfaces must clearly remain available, it is felt
                     that in many cases they may be misleading. Thus, for instance, the
                     <code>MathMLFractionElement</code> interface provides for access to
                     <code>numerator</code> and <code>denominator</code> attributes; a call to
                     <code>setDenominator(newNode)</code> is less ambiguous from a calling
                     application's perspective than a call to <code>Node::replaceNode(newNode,
                        Node::childNodes().item(2))</code>.
                  </p>
               </li>
            </ul>
            <p>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.
            </p>
            <p>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.
            </p>
            <p>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.
            </p>
            <p>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.
            </p>
            <div class="div3">
               
               <h3><a name="id.8.1.1" id="id.8.1.1"></a>8.1.1 hasFeature String
               </h3>
               <p>Support for the MathML Document Object Model may be queried by calling the
                  <b>DOMImplementation::hasFeature</b> method with the test string "org.w3c.dom.mathml".
               </p>
            </div>
            <div class="div3">
               
               <h3><a name="id.8.1.2" id="id.8.1.2"></a>8.1.2 MathML DOM Extensions
               </h3>
               <p>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.
               </p>
               <div class="div4">
                  
                  <h4><a name="id.8.1.2.1" id="id.8.1.2.1"></a>8.1.2.1 Traversal and Range Interfaces
                  </h4>
                  <p>It is likely that a need will become obvious for MathML-specific specializations	of 
                     interfaces belonging to the
                     <a href="http://www.w3.org/TR/DOM-Level-2-Traversal-Range/traversal.html">
                        Traversal</a> and 
                     <a href="http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html">Range</a> 
                     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.
                  </p>
               </div>
               <div class="div4">
                  
                  <h4><a name="id.8.1.2.2" id="id.8.1.2.2"></a>8.1.2.2 Embedding Issues
                  </h4>
                  <p>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.
                  </p>
                  <p>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.
                  </p>
               </div>
            </div>
         </div>
      </div>
      <div class="minitoc">
         
           Overview: <a href="overview.html">Mathematical Markup Language (MathML) Version 2.0 (Second Edition)</a><br>
           Previous:     7 <a href="chapter7.html">The MathML Interface</a><br>
           Next:     A <a href="appendixa.html">Parsing MathML</a></div>
   </body>
</html>