Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM length Property

XML DOM length Property


NamedNodeMap Object Reference NamedNodeMap object


Definition and Usage

The length property returns the number of nodes in a NamedNodeMap.

Syntax

nodemapObject.length


Example

The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and get the value of the "category" attribute of the first The number of attributes in the element:

Example

xmlDoc=loadXMLDoc("books.xml");

x=xmlDoc.getElementsByTagName('book');

document.write(x.item(0).attributes.length);

The code above will output:

1

Try it »


Try it

length - Returns the number of nodes in a node list

length - Loop through the nodes in a NodeList


NamedNodeMap Object Reference NamedNodeMap object