Xmlnode_Object HasElement Method

Returns True if a specified element is a child of the current node.

… xmlnode_object.HasElement(element)

Prerequisites

The current node must be of type "element" or "document".

Parameters

element

A required String expression that specifies the name of the element to be found.

Remarks

This is a convenience method that finds a named element. The element must be an immediate child of the current node. If an element with the specified name is found, a True value is returned. Otherwise, a False value is returned.

Examples

Dim doc As XmlDoc 
Dim root As XmlNode
doc = New XmlDoc("my_doc")
root = doc.DocumentElement
root.AddElement("section1", "Data for section 1")
Console.Writeline(root.HasElement("section1")) ' Output is "-1"

See Also

XML Classes | xmlnode_object.GetElement | xmlnode_object.GetElementNode | xmlnode_object.HasAttribute