ZVON > References > DOM2 Reference

  Glossary 

DOM2-core interfaces

fundamental
DOMImplementation, DocumentFragment, Document, Node, NodeList, NamedNodeMap, CharacterData, Attr, Element, Text, Comment - all conforming implementations of the DOM (including HTML-only ones) must fully implement these interfaces.
extended
CDATASection, DocumentType, Notation, Entity, EntityReference, ProcessingInstruction - these interfaces are XML-oriented so HTML-only DOM implementation do not need to implement these objects.

Node Types

const unsigned short      ELEMENT_NODE                = 1
const unsigned short      ATTRIBUTE_NODE              = 2
const unsigned short      TEXT_NODE                   = 3
const unsigned short      CDATA_SECTION_NODE          = 4
const unsigned short      ENTITY_REFERENCE_NODE       = 5
const unsigned short      ENTITY_NODE                 = 6
const unsigned short      PROCESSING_INSTRUCTION_NODE = 7
const unsigned short      COMMENT_NODE                = 8
const unsigned short      DOCUMENT_NODE               = 9
const unsigned short      DOCUMENT_TYPE_NODE          = 10
const unsigned short      DOCUMENT_FRAGMENT_NODE      = 11
const unsigned short      NOTATION_NODE               = 12

Root, siblings, parents, children, ancestors, descendants

Example would be the best. Let's have this XML document:

  <?xml version="1.0"?>
  <test>
    <para>
      some text and <highlight>some highlighted text</highlight> in the first paragraph
    </para>
    <para>
      text in the last paragraph
    </para>
  </test>
<test> is the root element of the document. It is also parent of both <para> elements and ancestor of all elements in the document (<para>, <highlight>), which are in turn its descendants. <para> elements are siblings.


Live objects in DOM

An object is live if any change to the underlying document structure is reflected in the object.


XML namespaces


Quolified name, local name, namespace URI, namespace prefix

Let's have MathML element <apply>. It's local name is "apply". Namespace URI for MathML is "http://www.w3.org/1998/Math/MathML". If we define somewhere on parent element namespace prefix "mathml" (with construction xmlns:mathml="http://www.w3.org/1998/Math/MathML"), all MathML elements should use this prefix, so this will look like <mathml:apply>, which is called quolified name.
Of course - if all descendant elements will be from the same namespace, we can define explicit namespace on appropriate root element of the fragment, i.e. <apply xmlns="http://www.w3.org/1998/Math/MathML">.


DOMString


DOMTimeStamp


Other data types


name attribute in DOM HTML

For historical and other reasons some elements in HTML (...) have attribute name. To confuse developers this attribute plays similar role as later introduced attribute id and in a lot of cases they can be used for the same tasks (like accessing nodes in document via their name/id). But from the DOM view these two attributes are strictly devided and you can be quickly lost. See namedItem() method for more detailed explanation.


Convenience methods and properties

A convenience method is an operation on an object that could be accomplished by a program consisting of more basic operations on the object. Convenience methods are usually provided to make the API easier and simpler to use or to allow specific programs to create more optimized implementations for common operations. A similar definition holds for a convenience property.


HTML and XHTML documents

From the developers point of view the most important difference between HTML and XHTML documents is that the XHTML documents are valid XML documents. See XHTML 1.0, chapter 4 for detailed explanation.


XPointers

The XML Pointer Language (XPointer) - the language to be used as a fragment identifier for any URI-reference that locates a resource of Internet media type text/xml or application/xml. XPointer, which is based on the XML Path Language (XPath), supports addressing into the internal structures of XML documents. It allows for traversals of a document tree and choice of its internal parts based on various properties, such as element types, attribute values, character content, and relative position.