Element

public interface Element implements 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.

Note: 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 3 Core Specification.

Inherited Constant Summary

Public Method Summary

abstract String
getAttribute(String name)
Retrieves an attribute value by name.
abstract String
getAttributeNS(String namespaceURI, String localName)
Retrieves an attribute value by local name and namespace URI.
abstract Attr
getAttributeNode(String name)
Retrieves an attribute node by name.
abstract Attr
getAttributeNodeNS(String namespaceURI, String localName)
Retrieves an Attr node by local name and namespace URI.
abstract NodeList
getElementsByTagName(String name)
Returns a NodeList of all descendant Elements with a given tag name, in document order.
abstract NodeList
getElementsByTagNameNS(String namespaceURI, String localName)
Returns a NodeList of all the descendant Elements with a given local name and namespace URI in document order.
abstract TypeInfo
getSchemaTypeInfo()
The type information associated with this element.
abstract String
getTagName()
The name of the element.
abstract 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.
abstract 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.
abstract void
removeAttribute(String name)
Removes an attribute by name.
abstract void
removeAttributeNS(String namespaceURI, String localName)
Removes an attribute by local name and namespace URI.
abstract Attr
removeAttributeNode(Attr oldAttr)
Removes the specified attribute node.
abstract void
setAttribute(String name, String value)
Adds a new attribute.
abstract void
setAttributeNS(String namespaceURI, String qualifiedName, String value)
Adds a new attribute.
abstract Attr
setAttributeNode(Attr newAttr)
Adds a new attribute node.
abstract Attr
setAttributeNodeNS(Attr newAttr)
Adds a new attribute.
abstract void
setIdAttribute(String name, boolean isId)
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute .
abstract void
setIdAttributeNS(String namespaceURI, String localName, boolean isId)
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute .
abstract void
setIdAttributeNode(Attr idAttr, boolean isId)
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute .

Inherited Method Summary