IXMLDOMDocument Object (Visual Basic .NET)

banner art

Previous Next

IXMLDOMDocument Object (Visual Basic .NET)

The IXMLDOMDocument object represents the top level of the XML source. It includes methods and properties to obtain or create all other XML DOM objects. For more information, see the Microsoft XML SDK 3.0 documentation available at the Microsoft Web site.

The IXMLDOMDocument object supports the following properties and methods.

Property Description
attributes Contains the list of attributes for this node. Read-only.
childNodes Contains a node list containing the children (for nodes that can have children). Read-only.
documentElement Contains the root element of the document. Read/write.
firstChild Contains the first child of this node. Read-only.
implementation Contains the IXMLDOMImplementation object for this document. Read-only.
lastChild Contains the last child of this node. Read-only.
nextSibling Contains the next sibling of this node in the parent's child list. Read-only.
nodeName Contains the qualified name of the element, attribute, or entity reference, or a fixed string for other node types. Read-only.
nodeType Specifies the XML DOM node type, which determines valid values and whether the node can have child nodes. Read-only.
nodeTypeString* Contains the node type in string form. Read-only.
nodeValue Contains the text associated with the node. Read/write.
ownerDocument Contains the root of the document that contains this node. Read-only.
parentNode Contains the parent node (for nodes that can have parents). Read-only.
previousSibling Contains the left sibling of this node. Read-only.
url* Returns the canonical URL for the most recently loaded XML document.
Method Description
appendChild Appends the supplied new child as the last child of this node.
cloneNode Creates a new node that is an exact clone of this node.
createAttribute Creates a new attribute with the specified name.
createElement Creates an element node using the specified name.
createNode* Creates a node using the supplied type, name, and namespace.
getElementsByTagName Returns a collection of elements that have the name specified in this method call.
hasChildNodes Returns a Boolean value indicating whether this node has children.
insertBefore Inserts a child node to the left of the specified node or at the end of the list.
load* Synchronously loads an XML document with the contents of the file at the specified location.
loadXML* Loads the supplied string into an XML document.
removeChild Removes the specified child node from the list of children and returns it.
replaceChild Returns the specified old child node and replaces it with the supplied new child node.
save* Saves an XML document to the specified location.

* Denotes an extension to the W3C DOM.

  • Note   For detailed information about using the C++ programming language to access the IXMLDOMDocument object, see the IXMLDOMDocument interface.


When the object-creation methods (such as createElement) are used on the document, nodes are created in the context of the document (the ownerDocument property of the node points to the document), 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, setAttributeNode).

Example Code

The following example demonstrates how to create a free-threaded IXMLDOMDocument object.

Imports interop_msxml
Imports Microsoft.WindowsMediaServices.Interop

On Error GoTo Err

' Declare variables.
Dim Server As New WMSServerClass()
Dim Playlist As IXMLDOMDocument

' Create a new playlist object.
Set Playlist = Server.CreatePlaylist
Exit Sub

' TODO: Handle errors.

See Also

Previous Next