org.w3c.dom
Interface Element

All Superinterfaces:
Node

 

All Known Implementing Classes

IIOMetadataNode
public interface Element
extends Node

The Element interface represents an element in an HTML or XML document. Elements may have attributes associated with them; since the Element interface inherits from Node, the generic Node interface attribute attributes may be used to retrieve the set of all attributes for an element. There are methods on the Element interface to retrieve either an Attr object by name or an attribute value by name. In XML, where an attribute value may contain entity references, an Attr object should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as a convenience.In DOM Level 2, the method normalize is inherited from the Node interface where it was moved.

See also the Document Object Model (DOM) Level 2 Core Specification.

 

Field Summary

 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 

 

Method Summary

 String getAttribute(String name)
    Retrieves an attribute value by name.
 Attr getAttributeNode(String name)
    Retrieves an attribute node by name.
 Attr getAttributeNodeNS(String namespaceURI, String localName)
    Retrieves an Attr node by local name and namespace URI.
 String getAttributeNS(String namespaceURI, String localName)
    Retrieves an attribute value by local name and namespace URI.
 NodeList getElementsByTagName(String name)
    Returns a NodeList of all descendant Elements with a given tag name, in the order in which they are encountered in a preorder traversal of this Element tree.
 NodeList getElementsByTagNameNS(String namespaceURI, String localName)
    Returns a NodeList of all the descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree.
 String getTagName()
    The name of the element.
 boolean hasAttribute(String name)
    Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.
 boolean hasAttributeNS(String namespaceURI, String localName)
    Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise.
 void removeAttribute(String name)
    Removes an attribute by name.
 Attr removeAttributeNode(Attr oldAttr)
    Removes the specified attribute node.
 void removeAttributeNS(String namespaceURI, String localName)
    Removes an attribute by local name and namespace URI.
 void setAttribute(String name, String value)
    Adds a new attribute.
 Attr setAttributeNode(Attr newAttr)
    Adds a new attribute node.
 Attr setAttributeNodeNS(Attr newAttr)
    Adds a new attribute.
 void