Anfang des Inhaltsbereichs

Objektdokumentation Package DOM  Dokument im Navigationsbaum lokalisieren

Definition

The DOM presents documents as a hierarchy of "Node" objects that also implement other, more specialized interfaces. Some types of nodes may have child nodes of various types, and others are leaf nodes that cannot have anything below them in the document structure.

Use

The DOM also specifies a "NodeList" interface to handle ordered lists of Nodes, such as the children of a Node, or the elements returned by the Element:getElementsByTagName method, and also a NamedNodeMap interface to handle unordered sets of Nodes referenced by their name attribute, such as the Attributes of an Element. NodeLists and NamedNodeMaps in the DOM are "live", that is, changes to the underlying document structure are reflected in all relevant NodeLists and NamedNodeMaps. For example, if a DOM user gets a NodeList object containing the children of an Element, then subsequently adds more children to that element (or removes children, or modifies them), those changes are automatically reflected in the NodeList without further action on the user's part. Likewise changes to a Node in the tree are reflected in all references to that Node in NodeLists and NamedNodeMaps.

Structure

The package DOM contains the following interfaces:

if_ixml_att_list_decl

if_ixml_attribute

if_ixml_attribute_decl

if_ixml_cdata_section

if_ixml_character_data

if_ixml_comment

if_ixml_cond_dtd_section

if_ixml_content_particle

if_ixml_document

if_ixml_document_fragment

if_ixml_document_type

if_ixml_element

if_ixml_element_decl

if_ixml_entity_decl

if_ixml_entity_ref

if_ixml_named_node_map

if_ixml_namespace_context

if_ixml_namespace_decl

if_ixml_node

if_ixml_node_collection

if_ixml_node_filter

if_ixml_node_filter_combining

if_ixml_node_iterator

if_ixml_node_list

if_ixml_notation_decl

if_ixml_pi

if_ixml_pi_parsed

if_ixml_pi_unparsed

if_ixml_text

Integration

The iXML library implements a superset of the W3C DOM Level 1 Core and XML specification as defined in the document PR-DOM-Level-1-19980818.

Differences between the DOM Level 1 Specification and the iXML implementation are usually:

  1. Differences in method or interface names: The DOM specification is somehow inconsistent in naming convensions for method names and interfaces. In addition to that a few classes/interfaces had to be renamed due to the iXML extensions for the DTD representation (e.g. Notation and Entity have been renamed to NotationDecl and EntityDecl). In some instances the W3C DOM does provide direct access to attributes of classes, where iXML provides a set and get method explicitely. In order to get a consistent naming scheme, some W3C method names have been prefix with "get".
  2. iXML provides extensions to the W3C DOM classes and interfaces to represent the document type definition (DTD) as well. The W3C has not yet released a specification for the DOM representation of the DTD. As soon as this document becomes publicly available, the iXML interfaces might adopt the suggested methods.
  3. In addition to NodeList and NamedNodeMap, iXML used the additional class NodeCollection. The NodeList class as defined in the W3C suggest an implementation as an iterator, whereas in a lot of cases a container or collection would be much more appropriate. For performance reasons, the iXML implementation of the DOM separates these two concepts clearly: NodeLists act as iterators over lists of consecutive nodes in the DOM tree (e.g. the child nodes of a node). NodeCollections in contrast are a set of references to arbitrary nodes, which don't have to be in a particular relation to each other. NodeCollections are - as the name suggests - used to collect references to otherwise unrelated nodes.

Other than that the iXML library follows the W3C DOM Level 1 specification very closely and does not deliberately introduce differences in the implementation. Everybody familiar with the W3C DOM will immediately recognize the similarities with the iXML implementation.