June 19, 2011, 1:22 p.m.
posted by equivalent
The org.w3c.dom package includes 13 different subclasses of Node that represent the various possible components of a DOM tree:
The root of the DOM tree. Acts as a factory class for the other kinds of nodes; offers access to the root element, document type declaration, and DOM implementation.
Represents the document type declaration. Provides access to the notations and entities declared in the document's DTD.
Represents an element, including its local name, prefixed name, namespace URI, and attributes.
A common superinterface for Text CDATASection, and Comment. Provides methods to read and modify the text content of these nodes.
Represents a text node in the DOM tree. Has a method to split a text node into two text nodes.
Represents an attribute of an element; not part of the tree. Has methods to get the name, value, owner element, and default status of an attribute and to change the value of an attribute (but not the name). Most of the time, the attribute-related methods in the Element interface are used rather than working directly with attribute nodes.
Represents a comment node in the DOM tree. Inherits all its methods from the superinterfaces CharacterData and Node.
Represents a processing instruction node in the DOM tree. Has methods to get the target and to get and set the data.
Represents a CDATA section node in the DOM tree. Inherits all its methods from the superinterfaces Text, CharacterData, and Node.
Represents an entity reference node in the DOM tree. The children of this node are formed from the replacement text of the entity. Some parsers resolve entity references without putting any entity reference nodes in the tree.
Represents a parsed or unparsed general entity declared in the DTD. Includes methods to get the public and system ID of the entity. The children of an Entity object are formed from the replacement text of the entity. Entity objects are only accessible through the NamedNodeMap returned by the getEntities() method in the DocumentType interface.
Represents a notation declared in the DTD. Includes methods to get the public ID and/or system ID of the notation. Only accessible through the NamedNodeMap returned by the getNotations() method in the DocumentType interface.
A placeholder for a part of a document that contains multiple sibling nodes that can be moved as a group. It differs from other nodes in that when a document fragment is inserted into a node, the children of the document fragment are placed in that node, but not the document fragment itself.
Each of these interfaces inherits the methods of the Node interface as well as methods providing unique functionality for that particular kind of node.