Magazine |
| | Community |
| | Workshop |
| | Tools & Samples |
| | Training |
| | Site Info |
|
|
||||||||
|
Welcome to the XML Document Object Model (DOM) Reference documentation.
The DOM is a World Wide Web Consortium (W3C) recommendation available at http://www.w3.org/TR/REC-DOM-Level-1/ (October 1, 1998).
This reference documentation supplements the W3C recommendation and offers details relating to the Microsoft implementation supplied with Microsoft® Internet Explorer 5 Beta.
This documentation is provided in different formats for two different audiences:
The XML DOM provided with Internet Explorer 5 Beta implements programming interfaces described in the W3C Document Object Model Core (Level 1) recommendation and includes methods that support related XML technologies: the Extensible Stylesheet Language (XSL), the XSL Pattern-Matching Syntax, namespaces, and data types.
The W3C Core (Level 1) recommendation defines two groups of DOM programming interfaces: fundamental and extended. The W3C fundamental interfaces are those interfaces that are needed to write applications that manipulate XML documents. The W3C defines extended interfaces as those that might make it more convenient for developers but are not essential.
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 to be of a specific node type, as defined by the DOMNodeType enumeration, which defines valid parent and child nodes for each node type. For most XML documents, the most common node types are element nodes, attribute nodes, and text nodes. 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.
This XML implementation supports both the fundamental and extended interfaces. In addition to the W3C Core (Level 1) fundamental and extended interfaces, this implementation provides other methods to support XSL, namespaces, and data types. For example, the selectNodes method supports the XSL Pattern-Matching 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.
In this implementation, the names of W3C fundamental and extended interfaces start with the DOM prefix, while the names of Microsoft-specific extensions start with the XMLDOM prefix. Alphabetical lists of all programming interfaces are provided for C++ developers and for JScript® (compatible with ECMA 262 language specification) and Visual Basic developers.
For script and Visual Basic developers, the most important of the provided programming objects is the DOMDocument object that you can create using the identifier "Microsoft.XMLDOM":
var mydoc = new ActiveXObject("Microsoft.XMLDOM");
The DOMDocument object exposes the properties and methods of the IXMLDOMDocument object along with the two events, ondataavailable and onreadystatechange. Other important and commonly used objects include the IXMLDOMNode, IXMLDOMNodeList, IXMLDOMNamedNodeMap, and IDOMParseError objects.
For C++ developers, these programming interfaces are exposed as the COM interfaces IXMLDOMDocument and IDOMDocument, IXMLDOMNode and IDOMNode, IXMLDOMNodeList and IDOMNodeList, IXMLDOMNamedNodeMap and IDOMNamedNodeMap, and IDOMParseError.
You can create the IXMLDOMDocument object and query for the other interfaces as follows:
HRESULT hr; IXMLDOMDocument * pXMLDoc; IXMLDOMNode * pXDN; // ... hr = CoInitialize(NULL); // check the return value, hr... hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (void**)&pXMLDoc); // check the return value, hr... hr = pXMLDoc->QueryInterface(IID_IXMLDOMNode, (void **)&pXDN); // check the return value
Does this content meet your programming needs? Write us!
© 1998 Microsoft Corporation. All rights reserved. Terms of use.