Share via


name Property (IXMLDOMAttribute)

 

Contains the attribute name.

Script Syntax

strValue = oXMLDOMAttribute.name;  

Example

The following script example creates an IXMLDOMAttribute object from an attribute of the first child of the root, and then displays the value of its name.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
var root;
var objDOMatt;
xmlDoc.async = false;
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   WScript.Echo("You have error " + myErr.reason);
} else {
   xmlDoc.load("books.xml");
   root = xmlDoc.documentElement;
   objDOMatt = root.firstChild.attributes.item(0);
   WScript.Echo(objDOMatt.name);
}

C/C++ Syntax

HRESULT get_name(  
    BSTR *attributeName);  

Parameters

attributeName[out, retval]
Name of the attribute. The value is the same as the nodeName property of the IXMLDOMNode object.

C/C++ Return Values

S_OK
Value returned if successful.

S_FALSE
Value when returning Null.

E_INVALIDARG
Value returned if the attributeName parameter is Null.

Remarks

String. The property is read-only. It returns the name of the attribute. The value is the same as the nodeName property of the IXMLDOMNode.

Versioning

Implemented in:

MSXML 3.0, MSXML 6.0

Applies to

IXMLDOMAttribute

See Also

nodeName Property1
IXMLDOMNode