Dom 简明教程
DOM - NamedNodeMap Object
NamedNodeMap 对象用于表示可通过名称访问的节点集合。
The NamedNodeMap object is used to represent collections of nodes that can be accessed by name.
Attributes
下表列出了 NamedNodeMap 对象的属性。
The following table lists the Property of the NamedNodeMap Object.
Attribute |
Type |
Description |
unsigned long |
It gives the number of nodes in this map. The range of valid child node indices is 0 to length-1 inclusive. |
Methods
下表列出了 NamedNodeMap 对象的方法。
The following table lists the methods of the NamedNodeMap object.
S.No. |
Methods & Description |
1 |
getNamedItem ()Retrieves the node specified by name. |
2 |
getNamedItemNS ()Retrieves a node specified by local name and namespace URI. |
3 |
item ()Returns the indexth item in the map. If index is greater than or equal to the number of nodes in this map, this returns null. |
4 |
removeNamedItem ()Removes a node specified by name. |
5 |
removeNamedItemNS ()Removes a node specified by local name and namespace URI. |
6 |
setNamedItem ()Adds a node using its nodeName attribute. If a node with that name is already present in this map, it is replaced by the new one. |
7 |
setNamedItemNS ()Adds a node using its namespaceURI and localName. If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one. Replacing a node by itself has no effect. |