XML DOM removeNamedItem() Method
NamedNodeMap object
Definition and Usage
The removeNamedItem() method removes the specified node.
If the removed attribute has a default value, a new attribute is created immediately, along with the namespace URI, local name, and prefix.
This method returns the removed node.
Syntax
removeNamedItem(nodename)
| Parameters | Description |
|---|---|
| nodename | The name of the node to remove |
Example
The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, loop through the
Example
xmlDoc
=
loadXMLDoc
(
"
books.xml
"
)
;
x
=
xmlDoc
.
getElementsByTagName
(
'
book
'
)
;
for
(
i
=
0
;
i
<
x
.
length
;
i
++
)
{
x
.
item
(
i
)
.
attributes
.
removeNamedItem
(
"
category
"
)
;
}
Try it »
NamedNodeMap object