The item() method returns the node at the specified index in a node list.
Parameter | Description |
---|---|
index | The index |
The following code fragment loads "books.xml" into xmlDoc using loadXMLDoc(), loops through the <book> elements and prints the values of the category attributes:
The output of the code above will be:
item() - Loop through the items in a node list
getNamedItem() - Change an item's value