<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl" href="../../../Math/XSL/mathml.xsl"?>

<!DOCTYPE html
  SYSTEM "mathml.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <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}

  .error { color: red }
  .minitoc { border-style: solid;
             border-color: #0050B2; 
             border-width: 1px ; }
  .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; }
          
.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="http://www.w3.org/StyleSheets/TR/W3C-WD.css"/>
   </head>
   <body>

      <h1>
         <a id="dom-intro">

         </a>8 Document Object Model for MathML</h1><!-- TOP NAVIGATION BAR -->
      <div class="minitoc">

  Overview: <a href="overview.xml">Mathematical Markup Language (MathML) Version 2.0 (2nd Edition)
</a>
         <br class="html-compat"/>
  Previous: 7 <a href="chapter7.xml">The MathML Interface</a>
         <br class="html-compat"/>
  Next: A <a href="appendixa.xml">Parsing MathML</a>
         <br class="html-compat"/>
         <br class="html-compat"/>8 <a href="chapter8.xml">Document Object Model for MathML</a>
         <br class="html-compat"/>    8.1 <a href="chapter8.xml#dom-intro.intro">Introduction</a>
         <br class="html-compat"/>        8.1.1 <a href="chapter8.xml#id.8.1.1">hasFeature String</a>
         <br class="html-compat"/>        8.1.2 <a href="chapter8.xml#id.8.1.2">MathML DOM Extensions</a>
         <br class="html-compat"/>            8.1.2.1 <a href="chapter8.xml#id.8.1.2.1">Traversal and Range Interfaces</a>
         <br class="html-compat"/>            8.1.2.2 <a href="chapter8.xml#id.8.1.2.2">Embedding Issues</a>
         <br class="html-compat"/>
      </div>
      <div class="div1">
         <div class="div2">

            <h2>
               <a 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.xml">
                  <b>D Document Object Model for MathML</b>
               </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 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 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 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 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.xml">Mathematical Markup Language (MathML) Version 2.0 (2nd Edition)
</a>
         <br class="html-compat"/>
  Previous:     7 <a href="chapter7.xml">The MathML Interface</a>
         <br class="html-compat"/>
  Next:     A <a href="appendixa.xml">Parsing MathML</a>
      </div>
   </body>
</html>