Name
NamedNodeMap
Synopsis
This interface is similar to a NodeList, but its designed to allow the
accessing of nodes from the list by name. Nodes are not guaranteed
to be in any particular order within the map. This interface is not
defined in terms of the Node
interface.
lengthThe number of nodes in the map. As with the
NodeList, iflengthis 10 then actual indexes are0through9.getNamedItem(name)This method retrieves the node specified by the parameter
name. The node is returned if found, orNoneis returned if not.getNamedItemNS(namespaceURI, localName)This method returns a node matching both the
localNameandnamespaceURIsupplied as parameters.item(index)Returns the node at position
index, orNoneifindexis out of range.removeNamedItem(name)Removes the node specified by
name. If the node is anAttr(XML attribute) and has a default value (as specified in the DTD), the default value is then substituted and keeps the same namespace URI, local name, and prefix. The removed node is returned.removeNamedItemNS(namespaceURI, localName)Identical to
removeNamedItem, with one exception: the search criteria includes thenamespaceURIas well as thelocalNameto match a node from the map. The removed node is returned.setNamedItem(arg)The first parameter,
arg, is expected to be a node object. If a node with the same name already exists, it is replaced with the new one, and the old one is returned. A value ofNoneis returned if nodes are added, but not replaced.setNamedItemNS( ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access