IXMLDOMNode.parentNode (Visual Basic .NET)
Previous | Next |
IXMLDOMNode.parentNode (Visual Basic .NET)
The parentNode property contains the parent node of the IXMLDOMNode object.
Syntax
IXMLDOMNode = IXMLDOMNode.parentNode
Remarks
The property is read-only. All nodes except Document and Attribute nodes can have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, the parent is NULL.
The value of the IXMLDOMNode object that is returned depends on the type of node on which the parentNode property is called, as shown in the following table. For example, if the node type is NODE_ELEMENT, an IXMLDOMNode object is returned containing the parent node for that element node.
Node type | Value returned |
NODE_ATTRIBUTE NODE_DOCUMENT |
Returns NULL; these nodes do not have parents. |
NODE_COMMENT | Returns the element, entity reference, document type, or document containing the comment. |
NODE_ELEMENT | Returns the parent node of the element. If the element is the root node in the tree, the parent is the document node. If the node is the document node, parentNode is NULL. |
NODE_PROCESSING_INSTRUCTION | Returns the document or element, containing the processing instruction. |
NODE_TEXT | Returns the parent element or attribute. |
Example Code
The following example creates an IXMLDOMNode object from another node object's parent.
Imports interop_msxml Imports Microsoft.WindowsMediaServices.Interop On Error GoTo Err ' Declare variables. Dim Server As New WMSServerClass() Dim Playlist As IXMLDOMDocument Dim currNode As IXMLDOMNode Dim newNode As IXMLDOMNode ' Create a new playlist object. Set Playlist = Server.CreatePlaylist ' Load a playlist. Playlist.Load ("file://c:\wmpub\wmroot\simple.wsx") ' Retrieve the first child node of the second child node ' in the root element. Set currNode = Playlist.documentElement.childNodes.Item(1).childNodes.Item(0) ' Retrieve the parent node. Set newNode = currNode.parentNode Exit Sub Err: ' TODO: Handle errors.
Requirements
Reference: Add references to Microsoft.WindowsMediaServices and interop_msxml.
Namespace: Microsoft.WindowsMediaServices.Interop, interop_msxml.
Assembly: Microsoft.WindowsMediaServices.dll, interop_msxml.dll.
Library: WMSServerTypeLib.dll, msxml.dll.
Platform: Windows Server 2003 family, Windows Server 2008 family.
See Also
Previous | Next |