November 2002
Intermediate to advanced
1120 pages
21h 2m
English
If for some reason you want all the attributes of an element or you don't know their names, you can use the getAttributes() method to retrieve a NamedNodeMap inherited from the Node.[3] The NamedNodeMap interface, summarized in Example 11.5, has methods to get and set the various named nodes as well as to iterate through the nodes as a list. Here it's used for attributes, but soon you'll see it used for notations and entities as well.
[3] Why getAttributes() is in Node instead of Element I have no idea. Elements are the only kind of node that can have attributes. For all other types of node, getAttributes() returns null.
package org.w3c.dom; public interface NamedNodeMap { // ... |
Read now
Unlock full access