nodeName Property1

 

Returns the qualified name for attribute, document type, element, entity, or notation nodes. Returns a fixed string for all other node types. Read-only.

strValue = oXMLDOMNode.nodeName;  

Example

The following script example creates an IXMLDOMNode object and displays its name.

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

strValue = oXMLDOMNode.nodeName  

HRESULT get_nodeName(  
    BSTR *name);  

Parameters

name[out, retval]
Node name, which varies depending on the node type.

C/C++ Return Values

S_OK
Value returned if successful.

E_INVALIDARG
Value returned if the name parameter is Null.

String. The property is read-only and always contains a non-empty string. The nodeName property contains the qualified name for the element, attribute, or entity reference. For example, it returns xxx:yyy for the element <xxx:yyy>.

The node name value varies, depending on the nodeType property.

NODE_ATTRIBUTEContains the name of the attribute.
NODE_CDATA_SECTIONContains the literal string "#cdata-section".
NODE_COMMENTContains the literal string "#comment".
NODE_DOCUMENTContains the literal string "#document".
NODE_DOCUMENT_TYPEContains the name of the document type; for example, xxx in <!DOCTYPE xxx ...>.
NODE_DOCUMENT_FRAGMENTContains the literal string "#document-fragment".
NODE_ELEMENTContains the name of the XML tag, with any namespace prefix included if present.
NODE_ENTITYContains the name of the entity.
NODE_ENTITY_REFERENCEContains the name of the entity referenced. Note that the name does not include the leading ampersand or the trailing semicolon. The name includes the namespace if one is present.
NODE_NOTATIONContains the name of the notation.
NODE_PROCESSING_INSTRUCTIONContains the target; the first token following the <? characters.
NODE_TEXTContains the literal string "#text".

Implemented in: MSXML 3.0, MSXML 6.0

IXMLDOMAttribute | IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | IXMLDOMDocument-DOMDocument | IXMLDOMDocumentFragment | IXMLDOMDocumentType | IXMLDOMElement | IXMLDOMEntity | IXMLDOMEntityReference | IXMLDOMNode | IXMLDOMNotation | IXMLDOMProcessingInstruction | IXMLDOMText

nodeType Property1

Show: