org.apache.xerces.dom

## Class ElementImpl

- java.lang.Object
- - org.apache.xerces.dom.NodeImpl
  - - org.apache.xerces.dom.ChildNode
    - - org.apache.xerces.dom.ParentNode
      - - org.apache.xerces.dom.ElementImpl

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.w3c.dom.Element, org.w3c.dom.ElementTraversal, org.w3c.dom.events.EventTarget, org.w3c.dom.Node, org.w3c.dom.NodeList, org.w3c.dom.TypeInfo
  Direct Known Subclasses:
    DeferredElementImpl, ElementNSImpl

      public class ElementImpl
      extends ParentNode
      implements org.w3c.dom.Element, org.w3c.dom.ElementTraversal, org.w3c.dom.TypeInfo

  Elements represent most of the "markup" and structure of the document. They contain both the data for the element itself (element name and attributes), and any contained nodes, including document text (as children).

  Elements may have Attributes associated with them; the API for this is defined in Node, but the function is implemented here. In general, XML applications should retrive Attributes as Nodes, since they may contain entity references and hence be a fairly complex sub-tree. HTML users will be dealing with simple string values, and convenience methods are provided to work in terms of Strings.

  ElementImpl does not support Namespaces. ElementNSImpl, which inherits from it, does.

  Since:
    PR-DOM-Level-1-19980818.
  Version:
    $Id: ElementImpl.java 938636 2010-04-27 20:24:07Z mrglavas $
  Author:
    Arnaud Le Hors, IBM, Joe Kesselman, IBM, Andy Clark, IBM, Ralf Pfeiffer, IBM, Michael Glavassevich, IBM
  See Also:
    `ElementNSImpl`, Serialized Form

  # INTERNAL:

    Usage of this class is not supported. It may be altered or removed at any time.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected AttributeMap` | `attributes` Attributes.
    `protected java.lang.String` | `name` Element name.

    - ### Fields inherited from class org.apache.xerces.dom.ParentNode

      `firstChild, fNodeListCache, ownerDocument`

    - ### Fields inherited from class org.apache.xerces.dom.ChildNode

      `nextSibling, previousSibling`

    - ### Fields inherited from class org.apache.xerces.dom.NodeImpl

      `DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, ID, IGNORABLEWS, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE`

    - ### 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`

    - ### Fields inherited from interface org.w3c.dom.TypeInfo

      `DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ElementImpl()`
    `` | `ElementImpl(CoreDocumentImpl ownerDoc, java.lang.String name)` Factory constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.w3c.dom.Node` | `cloneNode(boolean deep)` Return a duplicate copy of this Element.
    `java.lang.String` | `getAttribute(java.lang.String name)` Look up a single Attribute by name.
    `org.w3c.dom.Attr` | `getAttributeNode(java.lang.String name)` Look up a single Attribute by name.
    `org.w3c.dom.Attr` | `getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)` Retrieves an Attr node by local name and namespace URI.
    `java.lang.String` | `getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)` Introduced in DOM Level 2.
    `org.w3c.dom.NamedNodeMap` | `getAttributes()` Retrieve all the Attributes as a set.
    `java.lang.String` | `getBaseURI()` DOM Level 3 WD - Experimental.
    `int` | `getChildElementCount()` Returns the current number of element nodes that are children of this element.
    `protected NamedNodeMapImpl` | `getDefaultAttributes()` Get the default attributes.
    `org.w3c.dom.NodeList` | `getElementsByTagName(java.lang.String tagname)` Returns a NodeList of all descendent nodes (children, grandchildren, and so on) which are Elements and which have the specified tag name.
    `org.w3c.dom.NodeList` | `getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)` Introduced in DOM Level 2.
    `org.w3c.dom.Element` | `getFirstElementChild()` Returns the first child element node of this element.
    `org.w3c.dom.Element` | `getLastElementChild()` Returns the last child element node of this element.
    `org.w3c.dom.Element` | `getNextElementSibling()` Returns the next sibling element node of this element.
    `java.lang.String` | `getNodeName()` Returns the element name
    `short` | `getNodeType()` A short integer indicating what type of node this is.
    `org.w3c.dom.Element` | `getPreviousElementSibling()` Returns the previous sibling element node of this element.
    `org.w3c.dom.TypeInfo` | `getSchemaTypeInfo()` Method getSchemaTypeInfo.
    `java.lang.String` | `getTagName()` Returns the name of the Element.
    `java.lang.String` | `getTypeName()` The name of a type declared for the associated element or attribute, or `null` if unknown.
    `java.lang.String` | `getTypeNamespace()` The namespace of the type declared for the associated element or attribute or `null` if the element does not have declaration or if no namespace information is available.
    `protected int` | `getXercesAttribute(java.lang.String namespaceURI, java.lang.String localName)` NON-DOM: get inded of an attribute
    `protected org.w3c.dom.Attr` | `getXMLBaseAttribute()` NON-DOM Returns the xml:base attribute.
    `boolean` | `hasAttribute(java.lang.String name)` Introduced in DOM Level 2.
    `boolean` | `hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)` Introduced in DOM Level 2.
    `boolean` | `hasAttributes()` Introduced in DOM Level 2.
    `boolean` | `isDerivedFrom(java.lang.String typeNamespaceArg, java.lang.String typeNameArg, int derivationMethod)` Introduced in DOM Level 3.
    `boolean` | `isEqualNode(org.w3c.dom.Node arg)` DOM Level 3 WD- Experimental.
    `void` | `normalize()` In "normal form" (as read from a source file), there will never be two Text children in succession.
    `protected void` | `reconcileDefaultAttributes()` Reconcile default attributes.
    `void` | `removeAttribute(java.lang.String name)` Remove the named attribute from this Element.
    `org.w3c.dom.Attr` | `removeAttributeNode(org.w3c.dom.Attr oldAttr)` Remove the specified attribute/value pair.
    `void` | `removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName)` Introduced in DOM Level 2.
    `void` | `setAttribute(java.lang.String name, java.lang.String value)` Add a new name/value pair, or replace the value of the existing attribute having that name.
    `org.w3c.dom.Attr` | `setAttributeNode(org.w3c.dom.Attr newAttr)` Add a new attribute/value pair, or replace the value of the existing attribute with that name.
    `org.w3c.dom.Attr` | `setAttributeNodeNS(org.w3c.dom.Attr newAttr)` Introduced in DOM Level 2.
    `void` | `setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value)` Introduced in DOM Level 2.
    `void` | `setIdAttribute(java.lang.String name, boolean makeId)` DOM Level 3: register the given attribute node as an ID attribute
    `void` | `setIdAttributeNode(org.w3c.dom.Attr at, boolean makeId)` DOM Level 3: register the given attribute node as an ID attribute
    `void` | `setIdAttributeNS(java.lang.String namespaceURI, java.lang.String localName, boolean makeId)` DOM Level 3: register the given attribute node as an ID attribute
    `protected void` | `setOwnerDocument(CoreDocumentImpl doc)` NON-DOM set the ownerDocument of this node, its children, and its attributes
    `void` | `setReadOnly(boolean readOnly, boolean deep)` NON-DOM: Subclassed to flip the attributes' readonly switch as well.
    `protected void` | `setupDefaultAttributes()` Setup the default attributes.
    `protected int` | `setXercesAttributeNode(org.w3c.dom.Attr attr)` NON-DOM: sets attribute node for this element
    `protected void` | `synchronizeData()` Synchronizes the data (name and value) for fast nodes.

    - ### Methods inherited from class org.apache.xerces.dom.ParentNode

      `getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, getTextContent, hasChildNodes, insertBefore, item, removeChild, replaceChild, setTextContent, synchronizeChildren`

    - ### Methods inherited from class org.apache.xerces.dom.ChildNode

      `getNextSibling, getParentNode, getPreviousSibling`

    - ### Methods inherited from class org.apache.xerces.dom.NodeImpl

      `addEventListener, appendChild, changed, changes, compareDocumentPosition, compareTreePosition, dispatchEvent, getContainer, getFeature, getLocalName, getNamespaceURI, getNodeNumber, getNodeValue, getPrefix, getReadOnly, getUserData, getUserData, getUserDataRecord, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setNodeValue, setPrefix, setUserData, setUserData, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.w3c.dom.Node

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

- - ### Field Detail

    - #### name

          protected java.lang.String name

      Element name.

    - #### attributes

          protected AttributeMap attributes

      Attributes.

  - ### Constructor Detail

    - #### ElementImpl

          public ElementImpl(CoreDocumentImpl ownerDoc,
                     java.lang.String name)

      Factory constructor.

    - #### ElementImpl

          protected ElementImpl()

  - ### Method Detail

    - #### getNodeType

          public short getNodeType()

      A short integer indicating what type of node this is. The named constants for this value are defined in the org.w3c.dom.Node interface.
      Specified by:
        `getNodeType` in interface `org.w3c.dom.Node`
      Specified by:
        `getNodeType` in class `NodeImpl`

    - #### getNodeName

          public java.lang.String getNodeName()

      Returns the element name
      Specified by:
        `getNodeName` in interface `org.w3c.dom.Node`
      Specified by:
        `getNodeName` in class `NodeImpl`

    - #### getAttributes

          public org.w3c.dom.NamedNodeMap getAttributes()

      Retrieve all the Attributes as a set. Note that this API is inherited from Node rather than specified on Element; in fact only Elements will ever have Attributes, but they want to allow folks to "blindly" operate on the tree as a set of Nodes.
      Specified by:
        `getAttributes` in interface `org.w3c.dom.Node`
      Overrides:
        `getAttributes` in class `NodeImpl`
      See Also:
        `ElementImpl`

    - #### cloneNode

          public org.w3c.dom.Node cloneNode(boolean deep)

      Return a duplicate copy of this Element. Note that its children will not be copied unless the "deep" flag is true, but Attributes are always replicated.
      Specified by:
        `cloneNode` in interface `org.w3c.dom.Node`
      Overrides:
        `cloneNode` in class `ParentNode`
      Parameters:
        `deep` - If `true`, recursively clone the subtree under the specified node; if `false`, clone only the node itself (and its attributes, if it is an `Element`).
      Returns:
        The duplicate node.
      See Also:
        `Node.cloneNode(boolean)`

    - #### getBaseURI

          public java.lang.String getBaseURI()

      DOM Level 3 WD - Experimental. Retrieve baseURI
      Specified by:
        `getBaseURI` in interface `org.w3c.dom.Node`
      Overrides:
        `getBaseURI` in class `NodeImpl`

    - #### getXMLBaseAttribute

          protected org.w3c.dom.Attr getXMLBaseAttribute()

      NON-DOM Returns the xml:base attribute.

    - #### setOwnerDocument

          protected void setOwnerDocument(CoreDocumentImpl doc)

      NON-DOM set the ownerDocument of this node, its children, and its attributes
      Overrides:
        `setOwnerDocument` in class `ParentNode`

    - #### getAttribute

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

      Look up a single Attribute by name. Returns the Attribute's string value, or an empty string (NOT null!) to indicate that the name did not map to a currently defined attribute.

      Note: Attributes may contain complex node trees. This method returns the "flattened" string obtained from Attribute.getValue(). If you need the structure information, see getAttributeNode().

      Specified by:
        `getAttribute` in interface `org.w3c.dom.Element`
      Parameters:
        `name` - The name of the attribute to retrieve.
      Returns:
        The `Attr` value as a string, or the empty string if that attribute does not have a specified or default value.

    - #### getAttributeNode

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

      Look up a single Attribute by name. Returns the Attribute Node, so its complete child tree is available. This could be important in XML, where the string rendering may not be sufficient information.

      If no matching attribute is available, returns null.

      Specified by:
        `getAttributeNode` in interface `org.w3c.dom.Element`
      Parameters:
        `name` - The name (`nodeName`) of the attribute to retrieve.
      Returns:
        The `Attr` node with the specified name ( `nodeName`) or `null` if there is no such attribute.

    - #### getElementsByTagName

          public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)

      Returns a NodeList of all descendent nodes (children, grandchildren, and so on) which are Elements and which have the specified tag name.

      Note: NodeList is a "live" view of the DOM. Its contents will change as the DOM changes, and alterations made to the NodeList will be reflected in the DOM.

      Specified by:
        `getElementsByTagName` in interface `org.w3c.dom.Element`
      Parameters:
        `tagname` - The type of element to gather. To obtain a list of all elements no matter what their names, use the wild-card tag name "*".
      Returns:
        A list of matching `Element` nodes.
      See Also:
        `DeepNodeListImpl`

    - #### getTagName

          public java.lang.String getTagName()

      Returns the name of the Element. Note that Element.nodeName() is defined to also return the tag name.

      This is case-preserving in XML. HTML should uppercasify it on the way in.

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

    - #### normalize

          public void normalize()

      In "normal form" (as read from a source file), there will never be two Text children in succession. But DOM users may create successive Text nodes in the course of manipulating the document. Normalize walks the sub-tree and merges adjacent Texts, as if the DOM had been written out and read back in again. This simplifies implementation of higher-level functions that may want to assume that the document is in standard form.

      To normalize a Document, normalize its top-level Element child.

      As of PR-DOM-Level-1-19980818, CDATA -- despite being a subclass of Text -- is considered "markup" and will _not_ be merged either with normal Text or with other CDATASections.

      Specified by:
        `normalize` in interface `org.w3c.dom.Node`
      Overrides:
        `normalize` in class `ParentNode`

    - #### removeAttribute

          public void removeAttribute(java.lang.String name)

      Remove the named attribute from this Element. If the removed Attribute has a default value, it is immediately replaced thereby.

      The default logic is actually implemented in NamedNodeMapImpl. PR-DOM-Level-1-19980818 doesn't fully address the DTD, so some of this behavior is likely to change in future versions. ?????

      Note that this call "succeeds" even if no attribute by this name existed -- unlike removeAttributeNode, which will throw a not-found exception in that case.

      Specified by:
        `removeAttribute` in interface `org.w3c.dom.Element`
      Parameters:
        `name` - The name of the attribute to remove.
      Throws:
        `DOMException(NO_MODIFICATION_ALLOWED_ERR)` - if the node is readonly.

    - #### removeAttributeNode

          public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr)
                                               throws org.w3c.dom.DOMException

      Remove the specified attribute/value pair. If the removed Attribute has a default value, it is immediately replaced.

      NOTE: Specifically removes THIS NODE -- not the node with this name, nor the node with these contents. If the specific Attribute object passed in is not stored in this Element, we throw a DOMException. If you really want to remove an attribute by name, use removeAttribute().

      Specified by:
        `removeAttributeNode` in interface `org.w3c.dom.Element`
      Parameters:
        `oldAttr` - The `Attr` node to remove from the attribute list.
      Returns:
        the Attribute object that was removed.
      Throws:
        `DOMException(NOT_FOUND_ERR)` - if oldattr is not an attribute of this Element.
        `DOMException(NO_MODIFICATION_ALLOWED_ERR)` - if the node is readonly.
        `org.w3c.dom.DOMException` - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
        NOT_FOUND_ERR: Raised if `oldAttr` is not an attribute of the element.

    - #### setAttribute

          public void setAttribute(java.lang.String name,
                          java.lang.String value)

      Add a new name/value pair, or replace the value of the existing attribute having that name. Note: this method supports only the simplest kind of Attribute, one whose value is a string contained in a single Text node. If you want to assert a more complex value (which XML permits, though HTML doesn't), see setAttributeNode(). The attribute is created with specified=true, meaning it's an explicit value rather than inherited from the DTD as a default. Again, setAttributeNode can be used to achieve other results.
      Specified by:
        `setAttribute` in interface `org.w3c.dom.Element`
      Parameters:
        `name` - The name of the attribute to create or alter.
        `value` - Value to set in string form.
      Throws:
        `DOMException(INVALID_NAME_ERR)` - if the name is not acceptable. (Attribute factory will do that test for us.)
        `DOMException(NO_MODIFICATION_ALLOWED_ERR)` - if the node is readonly.

    - #### setAttributeNode

          public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr)
                                            throws org.w3c.dom.DOMException

      Add a new attribute/value pair, or replace the value of the existing attribute with that name.

      This method allows you to add an Attribute that has already been constructed, and hence avoids the limitations of the simple setAttribute() call. It can handle attribute values that have arbitrarily complex tree structure -- in particular, those which had entity references mixed into their text.

      Specified by:
        `setAttributeNode` in interface `org.w3c.dom.Element`
      Parameters:
        `newAttr` - The `Attr` node to add to the attribute list.
      Returns:
        If the `newAttr` attribute replaces an existing attribute, the replaced `Attr` node is returned, otherwise `null` is returned.
      Throws:
        `DOMException(INUSE_ATTRIBUTE_ERR)` - if the Attribute object has already been assigned to another Element.
        `org.w3c.dom.DOMException` - WRONG_DOCUMENT_ERR: Raised if `newAttr` was created from a different document than the one that created the element.
        NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
        INUSE_ATTRIBUTE_ERR: Raised if `newAttr` is already an attribute of another `Element` object. The DOM user must explicitly clone `Attr` nodes to re-use them in other elements.

    - #### getAttributeNS

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

      Introduced in DOM Level 2.

      Retrieves an attribute value by local name and namespace URI.

      Specified by:
        `getAttributeNS` in interface `org.w3c.dom.Element`
      Parameters:
        `namespaceURI` - The namespace URI of the attribute to retrieve.
        `localName` - The local name of the attribute to retrieve.
      Returns:
        String The Attr value as a string, or empty string if that attribute does not have a specified or default value.
      Since:
        WD-DOM-Level-2-19990923

    - #### setAttributeNS

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

      Introduced in DOM Level 2.

      Adds a new attribute. If the given namespaceURI is null or an empty string and the qualifiedName has a prefix that is "xml", the new attribute is bound to the predefined namespace "http://www.w3.org/XML/1998/namespace" [Namespaces]. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of the qualifiedName, and its value is changed to be the value parameter. This value is a simple string, it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNodeNS or setAttributeNode to assign it as the value of an attribute.

      Specified by:
        `setAttributeNS` in interface `org.w3c.dom.Element`
      Parameters:
        `namespaceURI` - The namespace URI of the attribute to create or alter.
        `qualifiedName` - The qualified name of the attribute to create or alter.
        `value` - The value to set in string form.
      Throws:
        `INVALID_CHARACTER_ERR:` - Raised if the specified name contains an invalid character.
        `NO_MODIFICATION_ALLOWED_ERR:` - Raised if this node is readonly.
        `NAMESPACE_ERR:` - Raised if the qualifiedName has a prefix that is "xml" and the namespaceURI is neither null nor an empty string nor "http://www.w3.org/XML/1998/namespace", or if the qualifiedName has a prefix that is "xmlns" but the namespaceURI is neither null nor an empty string, or if if the qualifiedName has a prefix different from "xml" and "xmlns" and the namespaceURI is null or an empty string.
      Since:
        WD-DOM-Level-2-19990923

    - #### removeAttributeNS

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

      Introduced in DOM Level 2.

      Removes an attribute by local name and namespace URI. If the removed attribute has a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix.

      Specified by:
        `removeAttributeNS` in interface `org.w3c.dom.Element`
      Parameters:
        `namespaceURI` - The namespace URI of the attribute to remove.
        `localName` - The local name of the attribute to remove.
      Throws:
        `NO_MODIFICATION_ALLOWED_ERR:` - Raised if this node is readonly.
      Since:
        WD-DOM-Level-2-19990923

    - #### getAttributeNodeNS

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

      Retrieves an Attr node by local name and namespace URI.
      Specified by:
        `getAttributeNodeNS` in interface `org.w3c.dom.Element`
      Parameters:
        `namespaceURI` - The namespace URI of the attribute to retrieve.
        `localName` - The local name of the attribute to retrieve.
      Returns:
        Attr The Attr node with the specified attribute local name and namespace URI or null if there is no such attribute.
      Since:
        WD-DOM-Level-2-19990923

    - #### setAttributeNodeNS

          public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr)
                                              throws org.w3c.dom.DOMException

      Introduced in DOM Level 2.

      Adds a new attribute. If an attribute with that local name and namespace URI is already present in the element, it is replaced by the new one.

      Specified by:
        `setAttributeNodeNS` in interface `org.w3c.dom.Element`
      Parameters:
        `newAttr` - The Attr node to add to the attribute list. When the Node has no namespaceURI, this method behaves like setAttributeNode.
      Returns:
        Attr If the newAttr attribute replaces an existing attribute with the same local name and namespace URI, the * previously existing Attr node is returned, otherwise null is returned.
      Throws:
        `WRONG_DOCUMENT_ERR:` - Raised if newAttr was created from a different document than the one that created the element.
        `NO_MODIFICATION_ALLOWED_ERR:` - Raised if this node is readonly.
        `INUSE_ATTRIBUTE_ERR:` - Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.
        `org.w3c.dom.DOMException` - WRONG_DOCUMENT_ERR: Raised if `newAttr` was created from a different document than the one that created the element.
        NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
        INUSE_ATTRIBUTE_ERR: Raised if `newAttr` is already an attribute of another `Element` object. The DOM user must explicitly clone `Attr` nodes to re-use them in other elements.
        NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature `"XML"` and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).
      Since:
        WD-DOM-Level-2-19990923

    - #### setXercesAttributeNode

          protected int setXercesAttributeNode(org.w3c.dom.Attr attr)

      NON-DOM: sets attribute node for this element

    - #### getXercesAttribute

          protected int getXercesAttribute(java.lang.String namespaceURI,
                               java.lang.String localName)

      NON-DOM: get inded of an attribute

    - #### hasAttributes

          public boolean hasAttributes()

      Introduced in DOM Level 2.
      Specified by:
        `hasAttributes` in interface `org.w3c.dom.Node`
      Overrides:
        `hasAttributes` in class `NodeImpl`
      Returns:
        `true` if this node has any attributes, `false` otherwise.
      See Also:
        `ElementImpl`

    - #### hasAttribute

          public boolean hasAttribute(java.lang.String name)

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

    - #### hasAttributeNS

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

      Introduced in DOM Level 2.
      Specified by:
        `hasAttributeNS` in interface `org.w3c.dom.Element`
      Parameters:
        `namespaceURI` - The namespace URI of the attribute to look for.
        `localName` - The local name of the attribute to look for.
      Returns:
        `true` if an attribute with the given local name and namespace URI is specified or has a default value on this element, `false` otherwise.

    - #### getElementsByTagNameNS

          public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                                    java.lang.String localName)

      Introduced in DOM Level 2.

      Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they would be encountered in a preorder traversal of the Document tree, starting from this node.

      Specified by:
        `getElementsByTagNameNS` in interface `org.w3c.dom.Element`
      Parameters:
        `namespaceURI` - The namespace URI of the elements to match on. The special value "*" matches all namespaces. When it is null or an empty string, this method behaves like getElementsByTagName.
        `localName` - The local name of the elements to match on. The special value "*" matches all local names.
      Returns:
        NodeList A new NodeList object containing all the matched Elements.
      Since:
        WD-DOM-Level-2-19990923

    - #### isEqualNode

          public boolean isEqualNode(org.w3c.dom.Node arg)

      DOM Level 3 WD- Experimental. Override inherited behavior from NodeImpl and ParentNode to check on attributes
      Specified by:
        `isEqualNode` in interface `org.w3c.dom.Node`
      Overrides:
        `isEqualNode` in class `ParentNode`
      Parameters:
        `arg` - The node to compare equality with.
      Returns:
        If the nodes, and possibly subtrees are equal, `true` otherwise `false`.

    - #### setIdAttributeNode

          public void setIdAttributeNode(org.w3c.dom.Attr at,
                                boolean makeId)

      DOM Level 3: register the given attribute node as an ID attribute
      Specified by:
        `setIdAttributeNode` in interface `org.w3c.dom.Element`
      Parameters:
        `at` - The attribute node.
        `makeId` - Whether the attribute is a of type ID.

    - #### setIdAttribute

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

      DOM Level 3: register the given attribute node as an ID attribute
      Specified by:
        `setIdAttribute` in interface `org.w3c.dom.Element`
      Parameters:
        `name` - The name of the attribute.
        `makeId` - Whether the attribute is a of type ID.

    - #### setIdAttributeNS

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

      DOM Level 3: register the given attribute node as an ID attribute
      Specified by:
        `setIdAttributeNS` in interface `org.w3c.dom.Element`
      Parameters:
        `namespaceURI` - The namespace URI of the attribute.
        `localName` - The local name of the attribute.
        `makeId` - Whether the attribute is a of type ID.

    - #### getTypeName

          public java.lang.String getTypeName()

      Description copied from interface: `org.w3c.dom.TypeInfo`
      The name of a type declared for the associated element or attribute, or `null` if unknown.
      Specified by:
        `getTypeName` in interface `org.w3c.dom.TypeInfo`
      See Also:
        `TypeInfo.getTypeName()`

    - #### getTypeNamespace

          public java.lang.String getTypeNamespace()

      Description copied from interface: `org.w3c.dom.TypeInfo`
      The namespace of the type declared for the associated element or attribute or `null` if the element does not have declaration or if no namespace information is available.
      Specified by:
        `getTypeNamespace` in interface `org.w3c.dom.TypeInfo`
      See Also:
        `TypeInfo.getTypeNamespace()`

    - #### isDerivedFrom

          public boolean isDerivedFrom(java.lang.String typeNamespaceArg,
                              java.lang.String typeNameArg,
                              int derivationMethod)

      Introduced in DOM Level 3.

      Checks if a type is derived from another by restriction. See: http://www.w3.org/TR/DOM-Level-3-Core/core.html#TypeInfo-isDerivedFrom

      Specified by:
        `isDerivedFrom` in interface `org.w3c.dom.TypeInfo`
      Parameters:
        `typeNamespaceArg` - The namspace of the ancestor type declaration
        `typeNameArg` - The name of the ancestor type declaration
        `derivationMethod` - The derivation method
      Returns:
        boolean True if the type is derived by restriciton for the reference type

    - #### getSchemaTypeInfo

          public org.w3c.dom.TypeInfo getSchemaTypeInfo()

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

    - #### setReadOnly

          public void setReadOnly(boolean readOnly,
                         boolean deep)

      NON-DOM: Subclassed to flip the attributes' readonly switch as well.
      Overrides:
        `setReadOnly` in class `ParentNode`
      Parameters:
        `readOnly` - True or false as desired.
        `deep` - If true, children are also toggled. Note that this will not change the state of an EntityReference or its children, which are always read-only.
      See Also:
        `NodeImpl.setReadOnly(boolean, boolean)`

    - #### synchronizeData

          protected void synchronizeData()

      Synchronizes the data (name and value) for fast nodes.
      Overrides:
        `synchronizeData` in class `NodeImpl`

    - #### setupDefaultAttributes

          protected void setupDefaultAttributes()

      Setup the default attributes.

    - #### reconcileDefaultAttributes

          protected void reconcileDefaultAttributes()

      Reconcile default attributes.

    - #### getDefaultAttributes

          protected NamedNodeMapImpl getDefaultAttributes()

      Get the default attributes.

    - #### getChildElementCount

          public final int getChildElementCount()

      Description copied from interface: `org.w3c.dom.ElementTraversal`
      Returns the current number of element nodes that are children of this element. `0` if this element has no child nodes that are of `nodeType` `1`.
      Specified by:
        `getChildElementCount` in interface `org.w3c.dom.ElementTraversal`
      See Also:
        Element Traversal Specification

    - #### getFirstElementChild

          public final org.w3c.dom.Element getFirstElementChild()

      Description copied from interface: `org.w3c.dom.ElementTraversal`
      Returns the first child element node of this element. `null` if this element has no child elements.
      Specified by:
        `getFirstElementChild` in interface `org.w3c.dom.ElementTraversal`
      See Also:
        Element Traversal Specification

    - #### getLastElementChild

          public final org.w3c.dom.Element getLastElementChild()

      Description copied from interface: `org.w3c.dom.ElementTraversal`
      Returns the last child element node of this element. `null` if this element has no child elements.
      Specified by:
        `getLastElementChild` in interface `org.w3c.dom.ElementTraversal`
      See Also:
        Element Traversal Specification

    - #### getNextElementSibling

          public final org.w3c.dom.Element getNextElementSibling()

      Description copied from interface: `org.w3c.dom.ElementTraversal`
      Returns the next sibling element node of this element. `null` if this element has no element sibling nodes that come after this one in the document tree.
      Specified by:
        `getNextElementSibling` in interface `org.w3c.dom.ElementTraversal`
      See Also:
        Element Traversal Specification

    - #### getPreviousElementSibling

          public final org.w3c.dom.Element getPreviousElementSibling()

      Description copied from interface: `org.w3c.dom.ElementTraversal`
      Returns the previous sibling element node of this element. `null` if this element has no element sibling nodes that come before this one in the document tree.
      Specified by:
        `getPreviousElementSibling` in interface `org.w3c.dom.ElementTraversal`
      See Also:
        Element Traversal Specification

Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.