XML DOM lengthProperty
NamedNodeMap Object
Definition and Usage
The length property returns the number of nodes in the NamedNodeMap.
Syntax
nodemapObject.length
Example
The following code snippet usesloadXMLDoc()put "books.xml"Load into xmlDoc, and retrieve the number of attributes in the first <book> element:"
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book');
document.write(x.item(0).attributes.length);
x=xmlDoc.getElementsByTagName('book');
document.write(x.item(0).attributes.length);
The code above will output:
1
Try it Yourself »
Try it Yourself
length - Returns the number of nodes in the node list
length - Loop through nodes in a node list
NamedNodeMap Objectother extensions