## com.gargoylesoftware.htmlunit.html
Class DomElement

    java.lang.Object
      com.gargoylesoftware.htmlunit.html.DomNode
          com.gargoylesoftware.htmlunit.html.DomNamespaceNode
              com.gargoylesoftware.htmlunit.html.DomElement

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, org.w3c.dom.Element, org.w3c.dom.Node

Direct Known Subclasses:
  HtmlElement

    public class DomElement

extends DomNamespaceNode
implements org.w3c.dom.Element

Version:
  $Revision: 4545 $
Author:
  Ahmed Ashour, Marc Guillemot, Tom Anderson
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.DomNode
`DomNode.ChildIterator, DomNode.DescendantElementsIterator`

Field Summary
`static java.lang.String` `ATTRIBUTE_NOT_DEFINED` Constant meaning that the specified attribute was not defined.
`static java.lang.String` `ATTRIBUTE_VALUE_EMPTY` Constant meaning that the specified attribute was found but its value was empty.

Fields inherited from class com.gargoylesoftware.htmlunit.html.DomNode
`AS_TEXT_BLANK, AS_TEXT_BLOCK_SEPARATOR, AS_TEXT_NEW_LINE, AS_TEXT_TAB, PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED`

Fields inherited from interface org.w3c.dom.Node

`ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE`

Constructor Summary
`DomElement(java.lang.String namespaceURI, java.lang.String qualifiedName, SgmlPage page, java.util.Map<java.lang.String,DomAttr> attributes)` Creates an instance of a DOM element that can have a namespace.

Method Summary
`DomNode` `cloneNode(boolean deep)`
`java.lang.String` `getAttribute(java.lang.String attributeName)` Returns the value of the attribute specified by name or an empty string.
`org.w3c.dom.Attr` `getAttributeNode(java.lang.String name)` Not yet implemented.
`org.w3c.dom.Attr` `getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)` Not yet implemented.
`java.lang.String` `getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)` Returns the value of the attribute specified by namespace and local name or an empty string.
`org.w3c.dom.NamedNodeMap` `getAttributes()`
`java.util.Map<java.lang.String,DomAttr>` `getAttributesMap()` Returns the map holding the attributes, keyed by name.
`DomNodeList<HtmlElement>` `getElementsByTagName(java.lang.String tagName)`
`DomNodeList<HtmlElement>` `getElementsByTagNameNS(java.lang.String namespace, java.lang.String localName)` Not yet implemented.
`java.lang.String` `getNodeName()` Returns this node's node name.
`short` `getNodeType()` Returns this node's node type.
`org.w3c.dom.TypeInfo` `getSchemaTypeInfo()` Not yet implemented.
`java.lang.String` `getTagName()` Returns the tag name of this element.
`boolean` `hasAttribute(java.lang.String attributeName)` Returns whether the attribute specified by name has a value.
`boolean` `hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)` Returns whether the attribute specified by namespace and local name has a value.
`boolean` `hasAttributes()`
`protected boolean` `isAttributeCaseSensitive()` Indicates if the attribute names are case sensitive.
`protected boolean` `isEmptyXmlTagExpanded()` Indicates if a node without children should be written in expanded form as XML (i.e.
`protected java.util.Map<java.lang.String,java.lang.String>` `namespaces()` Returns namespaces.
`protected void` `printOpeningTagContentAsXml(java.io.PrintWriter printWriter)` Prints the content between "<" and ">" (or "/>") in the output of the tag name and its attributes in XML format.
`protected void` `printXml(java.lang.String indent, java.io.PrintWriter printWriter)` Recursively write the XML data for the node tree starting at `node`.
`void` `removeAttribute(java.lang.String attributeName)` Removes an attribute specified by name from this element.
`org.w3c.dom.Attr` `removeAttributeNode(org.w3c.dom.Attr attribute)` Not yet implemented.
`void` `removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName)` Removes an attribute specified by namespace and local name from this element.
`void` `setAttribute(java.lang.String attributeName, java.lang.String attributeValue)` Sets the value of the attribute specified by name.
`org.w3c.dom.Attr` `setAttributeNode(org.w3c.dom.Attr attribute)` Not yet implemented.
`org.w3c.dom.Attr` `setAttributeNodeNS(org.w3c.dom.Attr attribute)` Not yet implemented.
`void` `setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String attributeValue)` Sets the value of the attribute specified by namespace and qualified name.
`void` `setIdAttribute(java.lang.String name, boolean isId)` Not yet implemented.
`void` `setIdAttributeNode(org.w3c.dom.Attr idAttr, boolean isId)` Not yet implemented.
`void` `setIdAttributeNS(java.lang.String namespaceURI, java.lang.String localName, boolean isId)` Not yet implemented.

Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNamespaceNode
`getLocalName, getNamespaceURI, getPrefix, getQualifiedName, setPrefix`

Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNode

`addDomChangeListener, appendChild, asText, asXml, checkChildHierarchy, compareDocumentPosition, fireNodeAdded, fireNodeDeleted, getAllHtmlChildElements, getAncestors, getBaseURI, getByXPath, getCanonicalXPath, getChildNodes, getChildren, getEndColumnNumber, getEndLineNumber, getFeature, getFirstByXPath, getFirstChild, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getPage, getParentNode, getPreviousSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, getTextContent, getUserData, hasChildNodes, insertBefore, insertBefore, isAncestorOf, isBlock, isDefaultNamespace, isDisplayed, isEqualNode, isSameNode, isSupported, isTrimmedText, lookupNamespaceURI, lookupPrefix, normalize, notifyIncorrectness, onAddedToPage, onAllChildrenAddedToPage, printChildrenAsXml, remove, removeAllChildren, removeChild, removeDomChangeListener, replace, replaceChild, selectNodes, selectSingleNode, setNextSibling, setNodeValue, setParentNode, setPreviousSibling, setReadyState, setScriptObject, setTextContent, setUserData`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.w3c.dom.Node

`appendChild, compareDocumentPosition, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData`

Field Detail

### ATTRIBUTE_NOT_DEFINED

    public static final java.lang.String ATTRIBUTE_NOT_DEFINED

  Constant meaning that the specified attribute was not defined.

### ATTRIBUTE_VALUE_EMPTY

    public static final java.lang.String ATTRIBUTE_VALUE_EMPTY

  Constant meaning that the specified attribute was found but its value was empty.

Constructor Detail

### DomElement

    public DomElement(java.lang.String namespaceURI,
                      java.lang.String qualifiedName,
                      SgmlPage page,
                      java.util.Map<java.lang.String,DomAttr> attributes)

  Creates an instance of a DOM element that can have a namespace.

  Parameters:
    `namespaceURI` - the URI that identifies an XML namespace
    `qualifiedName` - the qualified name of the element type to instantiate
    `page` - the page that contains this element
    `attributes` - a map ready initialized with the attributes for this element, or `null`. The map will be stored as is, not copied.

Method Detail

### getNodeName

    public java.lang.String getNodeName()

  Returns this node's node name.

  Specified by:
    `getNodeName` in interface `org.w3c.dom.Node`
  Specified by:
    `getNodeName` in class `DomNode`
  Returns:
    this node's node name

### getNodeType

    public final short getNodeType()

  Returns this node's node type.

  Specified by:
    `getNodeType` in interface `org.w3c.dom.Node`
  Specified by:
    `getNodeType` in class `DomNode`
  Returns:
    this node's node type

### namespaces

    protected java.util.Map<java.lang.String,java.lang.String> namespaces()

  Returns namespaces.

  Returns:
    namespaces

### getTagName

    public final java.lang.String getTagName()

  Returns the tag name of this element.

  Specified by:
    `getTagName` in interface `org.w3c.dom.Element`
  Returns:
    the tag name of this element

### hasAttributes

    public final boolean hasAttributes()

  Specified by:
    `hasAttributes` in interface `org.w3c.dom.Node`
  Overrides:
    `hasAttributes` in class `DomNode`

### hasAttribute

    public boolean hasAttribute(java.lang.String attributeName)

  Returns whether the attribute specified by name has a value.

  Specified by:
    `hasAttribute` in interface `org.w3c.dom.Element`
  Parameters:
    `attributeName` - the name of the attribute
  Returns:
    true if an attribute with the given name is specified on this element or has a default value, false otherwise.

### printOpeningTagContentAsXml

    protected void printOpeningTagContentAsXml(java.io.PrintWriter printWriter)

  Prints the content between "<" and ">" (or "/>") in the output of the tag name and its attributes in XML format.

  Parameters:
    `printWriter` - the writer to print in

### printXml

    protected void printXml(java.lang.String indent,
                            java.io.PrintWriter printWriter)

  Recursively write the XML data for the node tree starting at `node`.

  Overrides:
    `printXml` in class `DomNode`
  Parameters:
    `indent` - white space to indent child nodes
    `printWriter` - writer where child nodes are written

### isEmptyXmlTagExpanded

    protected boolean isEmptyXmlTagExpanded()

  Indicates if a node without children should be written in expanded form as XML (i.e. with closing tag rather than with "/>")

  Returns:
    `false` by default

### getAttribute

    public java.lang.String getAttribute(java.lang.String attributeName)

  Returns the value of the attribute specified by name or an empty string. If the result is an empty string then it will be either `ATTRIBUTE_NOT_DEFINED` if the attribute wasn't specified or `ATTRIBUTE_VALUE_EMPTY` if the attribute was specified but it was empty.

  Specified by:
    `getAttribute` in interface `org.w3c.dom.Element`
  Parameters:
    `attributeName` - the name of the attribute
  Returns:
    the value of the attribute or `ATTRIBUTE_NOT_DEFINED` or `ATTRIBUTE_VALUE_EMPTY`

### removeAttribute

    public void removeAttribute(java.lang.String attributeName)

  Removes an attribute specified by name from this element.

  Specified by:
    `removeAttribute` in interface `org.w3c.dom.Element`
  Parameters:
    `attributeName` - the attribute attributeName

### removeAttributeNS

    public final void removeAttributeNS(java.lang.String namespaceURI,
                                        java.lang.String localName)

  Removes an attribute specified by namespace and local name from this element.

  Specified by:
    `removeAttributeNS` in interface `org.w3c.dom.Element`
  Parameters:
    `namespaceURI` - the URI that identifies an XML namespace
    `localName` - the name within the namespace

### removeAttributeNode

    public final org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr attribute)

  Not yet implemented.

  Specified by:
    `removeAttributeNode` in interface `org.w3c.dom.Element`

### hasAttributeNS

    public final boolean hasAttributeNS(java.lang.String namespaceURI,
                                        java.lang.String localName)

  Returns whether the attribute specified by namespace and local name has a value.

  Specified by:
    `hasAttributeNS` in interface `org.w3c.dom.Element`
  Parameters:
    `namespaceURI` - the URI that identifies an XML namespace
    `localName` - the name within the namespace
  Returns:
    true if an attribute with the given name is specified on this element or has a default value, false otherwise.

### getAttributesMap

    public final java.util.Map<java.lang.String,DomAttr> getAttributesMap()

  Returns the map holding the attributes, keyed by name.

  Returns:
    the attributes map

### getAttributes

    public org.w3c.dom.NamedNodeMap getAttributes()

  Specified by:
    `getAttributes` in interface `org.w3c.dom.Node`
  Overrides:
    `getAttributes` in class `DomNode`

### setAttribute

    public final void setAttribute(java.lang.String attributeName,
                                   java.lang.String attributeValue)

  Sets the value of the attribute specified by name.

  Specified by:
    `setAttribute` in interface `org.w3c.dom.Element`
  Parameters:
    `attributeName` - the name of the attribute
    `attributeValue` - the value of the attribute

### setAttributeNS

    public void setAttributeNS(java.lang.String namespaceURI,
                               java.lang.String qualifiedName,
                               java.lang.String attributeValue)

  Sets the value of the attribute specified by namespace and qualified name.

  Specified by:
    `setAttributeNS` in interface `org.w3c.dom.Element`
  Parameters:
    `namespaceURI` - the URI that identifies an XML namespace
    `qualifiedName` - the qualified name (prefix:local) of the attribute
    `attributeValue` - the value of the attribute

### isAttributeCaseSensitive

    protected boolean isAttributeCaseSensitive()

  Indicates if the attribute names are case sensitive.

  Returns:
    `true`

### getAttributeNS

    public final java.lang.String getAttributeNS(java.lang.String namespaceURI,
                                                 java.lang.String localName)

  Returns the value of the attribute specified by namespace and local name or an empty string. If the result is an empty string then it will be either `ATTRIBUTE_NOT_DEFINED` if the attribute wasn't specified or `ATTRIBUTE_VALUE_EMPTY` if the attribute was specified but it was empty.

  Specified by:
    `getAttributeNS` in interface `org.w3c.dom.Element`
  Parameters:
    `namespaceURI` - the URI that identifies an XML namespace
    `localName` - the name within the namespace
  Returns:
    the value of the attribute or `ATTRIBUTE_NOT_DEFINED` or `ATTRIBUTE_VALUE_EMPTY`

### getAttributeNode

    public org.w3c.dom.Attr getAttributeNode(java.lang.String name)

  Not yet implemented.

  Specified by:
    `getAttributeNode` in interface `org.w3c.dom.Element`

### getAttributeNodeNS

    public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI,
                                               java.lang.String localName)

  Not yet implemented.

  Specified by:
    `getAttributeNodeNS` in interface `org.w3c.dom.Element`

### getElementsByTagName

    public DomNodeList<HtmlElement> getElementsByTagName(java.lang.String tagName)

  Specified by:
    `getElementsByTagName` in interface `org.w3c.dom.Element`

### getElementsByTagNameNS

    public DomNodeList<HtmlElement> getElementsByTagNameNS(java.lang.String namespace,
                                                           java.lang.String localName)

  Not yet implemented.

  Specified by:
    `getElementsByTagNameNS` in interface `org.w3c.dom.Element`

### getSchemaTypeInfo

    public org.w3c.dom.TypeInfo getSchemaTypeInfo()

  Not yet implemented.

  Specified by:
    `getSchemaTypeInfo` in interface `org.w3c.dom.Element`

### setIdAttribute

    public void setIdAttribute(java.lang.String name,
                               boolean isId)

  Not yet implemented.

  Specified by:
    `setIdAttribute` in interface `org.w3c.dom.Element`

### setIdAttributeNS

    public void setIdAttributeNS(java.lang.String namespaceURI,
                                 java.lang.String localName,
                                 boolean isId)

  Not yet implemented.

  Specified by:
    `setIdAttributeNS` in interface `org.w3c.dom.Element`

### setAttributeNode

    public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr attribute)

  Not yet implemented.

  Specified by:
    `setAttributeNode` in interface `org.w3c.dom.Element`

### setAttributeNodeNS

    public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr attribute)

  Not yet implemented.

  Specified by:
    `setAttributeNodeNS` in interface `org.w3c.dom.Element`

### setIdAttributeNode

    public final void setIdAttributeNode(org.w3c.dom.Attr idAttr,
                                         boolean isId)

  Not yet implemented.

  Specified by:
    `setIdAttributeNode` in interface `org.w3c.dom.Element`

### cloneNode

    public DomNode cloneNode(boolean deep)

  Specified by:
    `cloneNode` in interface `org.w3c.dom.Node`
  Overrides:
    `cloneNode` in class `DomNode`

Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.