Xmlnode_Object ParentNode Method

Returns the parent node of the current node.

…xmlnode_object.ParentNode

Prerequisites

None

Parameters

None

Remarks

This method returns a new XmlNode object that corresponds to the parent of the current node. If the current node is not part of a DOM tree, it will not have a parent and the returned object is Nothing. This method does not create a new node in the DOM tree.

Examples

Dim doc As XmlDoc
Dim
root As XmlNode
Dim
elem1 As XmlNode
Dim
sub1 As XmlNode
doc = New XmlDoc("my_doc")
root = doc.DocumentElement
elem1 = root.AddElementNode("section1", "Data for section 1")
sub1 = elem1.AddElementNode("section-a", "Sub-section data")
Console.Writeline(sub1.ParentNode.Name) ' Output is "section1"

See Also

XML Classes | xmlnode_object.NextSibling | xmlnode_object.OwnerDocument | xmlnode_object.PreviousSibling