Microsoft XML 2.5 SDK


 

XML DOM User Guide

[This is preliminary documentation and subject to change.]

With the XML Document Object Model (DOM), you can load and parse XML files, gather information about those files, and navigate and manipulate those files. The four main objects exposed by the XML DOM are XMLDOMDocument, XMLDOMNode, XMLDOMNodeList, and XMLDOMNamedNodeMap. Each of these objects exposes methods and properties that enable you to gather information about the instance of the object, manipulate the value and structure of the object, and navigate to other objects within the tree.

The DOM exposes the XML document as a tree structure that is composed of nodes; the DOM programming interfaces enable applications to traverse the tree and manipulate its nodes. Each node is defined as a specific node type, according to the DOMNodeType enumeration, which also defines 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 model because they are not considered child nodes of a parent. A distinct programming interface, the "named node map," is provided for attributes.

The W3C Document Object Model Level 1 Specification defines two groups of DOM programming interfaces: fundamental and extended. The W3C fundamental interfaces include those needed to write applications that manipulate XML documents. The W3C defines extended interfaces as those that might make it more convenient for developers.

The XML DOM provided with Internet Explorer 5 implements both the fundamental and extended interfaces. It also provides other methods to support XSL, XSL Patterns, namespaces, and Data Types. For example, the selectNodes method supports XSL Pattern Syntax to enable sophisticated queries for nodes within a particular context or subtree of the overall tree structure, and the transformNode method supports the use of XSL to perform transformations.

For script developers, the most important of the provided programming objects is the XMLDOMDocument object. The XMLDOMDocument object exposes properties and methods that allow you to navigate, query, and modify the content and structure of an XML document. Other important and commonly used objects include the XMLDOMNode, XMLDOMNodeList, XMLDOMNamedNodeMap, and XMLDOMParseError objects.

For C/C++/VB developers, these objects are exposed as the COM interfaces IXMLDOMDocument, IXMLDOMNode, IXMLDOMNodeList, IXMLDOMNamedNodeMap, and IXMLDOMParseError.

For complete reference material concerning each specific object and the methods and properties exposed by that object, see the reference documentation:

The following user guide is a brief explanation of how to use the XML DOM objects, the methods and properties exposed by each one, and DOM persistence.