About the XML DOM
The XML Document Object Model (DOM) is used to access and update the content, style, and structure of XML documents through a programmatic interface. This interface takes the form of an object model made up of objects, properties, methods, and events that can represent and manipulate the components of an XML document. The DOM stores the data of an XML document in a hierarchical, tree-like structure that mimics the structure of the document itself.
The DOM can be used to access any component of an XML document, including its elements, attributes, processing instructions, comments, and entity declarations. Any XML document can be loaded into the DOM. When an XML document is loaded into the DOM, it is read from start to finish and stored in the DOM as a logical model of nodes.
The DOM programming interface enables applications to traverse the tree and manipulate its nodes. Each node is defined as a specific node type according to the XML DOM enumerated constants, which also define valid parent and child nodes for each node type. For most XML documents, the most common node types are element, attribute, and text. Attributes occupy a special place in the object model because they are not considered child nodes of a parent; instead, they are treated as properties of elements.
The following table lists some of the DOM objects that can be used to work with an XML document, along with the XML node types that they represent.
DOM object | XML node type |
---|---|
XMLDOMDocument | Represents the XML document as a whole. This object exposes properties and methods that allow you to navigate, query, and modify the content and structure of an XML document. |
XMLDOMNode | Represents a single node in the document tree. This object is the base object for accessing data in the XML DOM, and it includes support for data types, namespaces, and XML Schemas. |
XMLDOMNodeList | Represents a collection of nodes. This object enables iteration and indexed access operations on the live collection of IXMLDOMNode. |
XMLDOMElement | Represents an element of the XML document. |
XMLDOMAttribute | Represents an attribute of the XML document. |