The NamedNodeMap Interface

A NamedNodeMap is returned when the attributes attribute of the node interface is invoked. Although the items in a NamedNodeMap are indexed, this is for convenience. Unlike in a NodeList, the position of an item is not significant. Items in a named node map will usually be accessed by name.

The getNamedItem(), setNamedItem(), removeNamedItem() Methods

As the names suggest, these methods retrieve, add, and remove the node of that name. SetNamedItem() requires a node object as an argument. The other two require a string as their argument.

(d)The item() Method

This method returns the node object of that index.

The length Attribute

Returns the length of the NamedNodeMap. Listing 15.9 is an example of ...

Get XML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.