Partager via


DOMDocument

Represents the top level of the XML source. Includes members for retrieving and creating all other XML objects.

Remarks

DOMDocument represents the top node in the tree. It implements all of the base Document Object Model (DOM) document methods and provides additional members that support Extensible Stylesheet Language (XSL) and XML transformations.

Only one object can be created: the document. All other objects are accessed or created from the document.

The document can be created using a rental-threaded model. The document-threading model is set by the following settings.

Setting Rental-threaded model
Version independent ProgID Msxml2.DOMDocument
ProgID Msxml2.DOMDocument.3.0
ClassID F6D90F11-9C73-11D3-B32E-00C04F990BB4
VB Class Name DOMDocument30

In addition to the DOM interfaces, DOMDocument implements a number of standard COM interfaces. You can call the QueryInterface method on DOMDocument to get the following interfaces.

Interface Usage
IUnknown DOMDocument is a wrapper object and each query for DOMDocument returns a new wrapper. You should only compare IUnknown interface pointers.
IConnectionPointContainer Supports outgoing events ondataavailable Event and onreadystatechange Event through IPropertyNotifySink::OnChanged and IDispatch::Invoke.
IDispatch Interface used by Visual Basic.
IDispatchEx Interface used by dynamic late-bound scripting languages such as Microsoft® Visual Basic®, Scripting Edition (VBScript) and Microsoft JScript® development system. This is not fully implemented. The following methods always return E_NOTIMPL: DeleteMemberByName or DeleteMemberByDispID, GetMemberProperties, GetMemberName, GetNextDispID, and GetNameSpaceParent.
IObjectSafety When the SetInterfaceSafetyOptions method is called with nonzero safety options, the Microsoft XML Parser (MSXML) will apply security rules before fetching XML data.
IObjectWithSite Enables a host application to provide extra contextual information, such the base URL.
IOleCommandTarget Used by a COM container to send an OLECMDID_STOP command to stop an asynchronous download.
IPersistMoniker Provides control over how to bind the XML document to persistent data. Both synchronous and asynchronous loading are supported using BindToStorage on the given IMoniker. Save is not called; therefore the BindToStorage, IsDirty, and SaveCompleted methods return E_NOTIMPL.
IPersistStream Used to save and load the XML document to and from an IStream.
IPersistStreamInit Updated version of IPersistStream.
IProvideClassInfo Provides an easy way to get ITypeInfo for the DOMDocument.
IStream You can read and write directly to the document through the IStream that is returned. You cannot Seek during a Write operation, and the following methods are not implemented on this stream: SetSize, CopyTo, Commit, Revert, LockRegion, UnlockRegion, and Clone. This allows you to build an XML document efficiently by providing chunks of XML and calling Write on the stream. You can also use this to test the persistence of your current DOM document by calling "xmldoc1.save(xmldoc2)." The Save method uses this IStream interface.

When the object-creation methods, such as createElement, are used on the document, nodes are created in the context of the document, the ow but the node is not part of the document tree. The node is only part of the document tree when it is explicitly added to the tree by calling insertBefore, replaceChild, or appendChild; or for attributes, using setAttributeNode).

This interface inherits from IXMLDOMNode.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Msxml2.h, Msxml2.idl.

See Also

DOMDocument Members | IXMLDOMNode | ondataavailable Event | onreadystatechange Event | appendChild Method | createElement Method | insertBefore Method | replaceChild | setAttributeNode Method | ownerDocument Property

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.