Xmlnode_Object HasAttribute Method

Returns True if the named attribute node is a child of this node.

… xmlnode_object.HasAttribute(attribute)

Prerequisites

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

Parameters

attribute

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

Remarks

This is a convenience method that finds a named attribute node. The attribute must be an immediate child of the current node.

If the 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.AddAttribute("color", "orange")
Console.Writeline(root.HasAttribute("color")) ' Output is "-1"

See Also

XML Classes | xmlnode_object.GetAttribute | xmlnode_object.GetAttributeNode | xmlnode_object.HasElement