XML DOM NamedNodeMap Object

The NamedNodeMap object represents an unordered list of nodes.

NamedNodeMap object

We can access the nodes in NamedNodeMap by node name.

NamedNodeMap can keep its own updates. If a node list or an element in the XML document is deleted or added, the nodes will also be automatically updated.

Attention:Note: In the named node mapping, nodes are not returned in any specific order.

Properties of NamedNodeMap object

Property Description
length Return the number of nodes in the list.

Methods of NamedNodeMap object

Method Description
getNamedItem() Return the node with a specific name.
getNamedItemNS() Return the node with a specific name and namespace.
item() Return the node at the specified index.
removeNamedItem() Remove the node with a specific name.
removeNamedItemNS() Remove the node with a specific name and namespace.
setNamedItem() Set the specified node (by name).
setNamedItemNS() Set the specified node (by name and namespace).