Top Description Fields Constructors Methods
com.sun.org.apache.xerces.internal.dom

public Class ElementImpl

extends ParentNode
implements Element, ElementTraversal, TypeInfo
Class Inheritance
All Implemented Interfaces
org.w3c.dom.TypeInfo, org.w3c.dom.ElementTraversal, org.w3c.dom.Element, org.w3c.dom.Node
Known Direct Subclasses
com.sun.org.apache.xerces.internal.dom.ElementNSImpl, com.sun.org.apache.xerces.internal.dom.DeferredElementImpl
Imports
org.w3c.dom.Attr, .DOMException, .Element, .ElementTraversal, .NamedNodeMap, .Node, .NodeList, .Text, .TypeInfo, com.sun.org.apache.xerces.internal.util.URI

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.

Authors
Arnaud Le Hors, IBM, Joe Kesselman, IBM, Andy Clark, IBM, Ralf Pfeiffer, IBM
Since
PR-DOM-Level-1-19980818.
See Also
ElementNSImpl

Field Summary

Modifier and TypeField and Description
protected AttributeMap
attributes

Attributes.

protected String
name

Element name.

pack-priv static final long
Inherited from com.sun.org.apache.xerces.internal.dom.ParentNode:
firstChildfNodeListCacheownerDocument

Constructor Summary

AccessConstructor and Description
public
ElementImpl(CoreDocumentImpl ownerDoc, String name)

Factory constructor.

protected

Method Summary

Modifier and TypeMethod and Description
public Node
cloneNode(boolean
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).
deep
)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.cloneNode.

Implements org.w3c.dom.Node.cloneNode.

Return a duplicate copy of this Element.

public String
getAttribute(String
The name of the attribute to retrieve.
name
)

Implements org.w3c.dom.Element.getAttribute.

Look up a single Attribute by name.

public Attr
getAttributeNode(String
The name (nodeName) of the attribute to retrieve.
name
)

Implements org.w3c.dom.Element.getAttributeNode.

Look up a single Attribute by name.

public Attr

Returns:

Attr The Attr node with the specified attribute local name and namespace URI or null if there is no such attribute.
getAttributeNodeNS
(String
The namespace URI of the attribute to retrieve.
namespaceURI
,
String
The local name of the attribute to retrieve.
localName
)

Implements org.w3c.dom.Element.getAttributeNodeNS.

Retrieves an Attr node by local name and namespace URI.

public String

Returns:

String The Attr value as a string, or empty string if that attribute does not have a specified or default value.
getAttributeNS
(String
The namespace URI of the attribute to retrieve.
namespaceURI
,
String
The local name of the attribute to retrieve.
localName
)

Implements org.w3c.dom.Element.getAttributeNS.

Introduced in DOM Level 2.

public NamedNodeMap

Returns:

all Attributes
getAttributes
()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.getAttributes.

Implements org.w3c.dom.Node.getAttributes.

Retrieve all the Attributes as a set.

public String

Returns:

the baseURI
getBaseURI
()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.getBaseURI.

Implements org.w3c.dom.Node.getBaseURI.

DOM Level 3 WD - Experimental.

public final int
getChildElementCount()

Implements org.w3c.dom.ElementTraversal.getChildElementCount.

Returns the current number of child nodes of the element which are of the Element type.

protected NamedNodeMapImpl
getDefaultAttributes()

Get the default attributes.

public NodeList
getElementsByTagName(String
The type of element to gather. To obtain a list of all elements no matter what their names, use the wild-card tag name "*".
tagname
)

Implements org.w3c.dom.Element.getElementsByTagName.

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

public NodeList

Returns:

NodeList A new NodeList object containing all the matched Elements.
getElementsByTagNameNS
(String
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.
namespaceURI
,
String
The local name of the elements to match on. The special value "*" matches all local names.
localName
)

Implements org.w3c.dom.Element.getElementsByTagNameNS.

Introduced in DOM Level 2.

public final Element
getFirstElementChild()

Implements org.w3c.dom.ElementTraversal.getFirstElementChild.

Returns a reference to the first child node of the element which is of the Element type.

private Element
public final Element
getLastElementChild()

Implements org.w3c.dom.ElementTraversal.getLastElementChild.

Returns a reference to the last child node of the element which is of the Element type.

private Element
public final Element
getNextElementSibling()

Implements org.w3c.dom.ElementTraversal.getNextElementSibling.

Returns a reference to the sibling node of the element which most immediately follows the element in document order, and which is of the Element type.

private Node
public String

Returns:

the node name
getNodeName
()

Implements abstract com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeName.

Implements org.w3c.dom.Node.getNodeName.

Returns the node name

public short
getNodeType()

Implements abstract com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeType.

Implements org.w3c.dom.Node.getNodeType.

A short integer indicating what type of node this is.

public final Element
getPreviousElementSibling()

Implements org.w3c.dom.ElementTraversal.getPreviousElementSibling.

Returns a reference to the sibling node of the element which most immediately precedes the element in document order, and which is of the Element type.

private Node
public TypeInfo

Returns:

TypeInfo
getSchemaTypeInfo
()

Implements org.w3c.dom.Element.getSchemaTypeInfo.

Method getSchemaTypeInfo.

public String
getTagName()

Implements org.w3c.dom.Element.getTagName.

Returns the name of the Element.

public String
getTypeName()

Implements org.w3c.dom.TypeInfo.getTypeName.

The name of a type declared for the associated element or attribute, or null if unknown.

public String
getTypeNamespace()

Implements org.w3c.dom.TypeInfo.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(String namespaceURI, String localName)

NON-DOM: get inded of an attribute

protected Attr

Returns:

the xml:base attribute
getXMLBaseAttribute
()

NON-DOM Returns the xml:base attribute.

public boolean
hasAttribute(String
The name of the attribute to look for.
name
)

Implements org.w3c.dom.Element.hasAttribute.

Introduced in DOM Level 2.

public boolean
hasAttributeNS(String
The namespace URI of the attribute to look for.
namespaceURI
,
String
The local name of the attribute to look for.
localName
)

Implements org.w3c.dom.Element.hasAttributeNS.

Introduced in DOM Level 2.

public boolean
public boolean

Returns:

boolean True if the type is derived by restriction for the reference type
isDerivedFrom
(String
The namspace of the ancestor type declaration
typeNamespaceArg
,
String
The name of the ancestor type declaration
typeNameArg
,
int
The derivation method
derivationMethod
)

Implements org.w3c.dom.TypeInfo.isDerivedFrom.

Introduced in DOM Level 3.

public boolean
isEqualNode(Node
The node to compare equality with.
arg
)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.isEqualNode.

Implements org.w3c.dom.Node.isEqualNode.

DOM Level 3 WD- Experimental.

pack-priv void
public void
normalize()

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.normalize.

Implements org.w3c.dom.Node.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.

public void
removeAttribute(String
The name of the attribute to remove.
name
)

Implements org.w3c.dom.Element.removeAttribute.

Remove the named attribute from this Element.

public Attr

Returns:

the Attribute object that was removed.
removeAttributeNode
(Attr
The Attr node to remove from the attribute list.
oldAttr
)

Implements org.w3c.dom.Element.removeAttributeNode.

Remove the specified attribute/value pair.

public void
removeAttributeNS(String
The namespace URI of the attribute to remove.
namespaceURI
,
String
The local name of the attribute to remove.
localName
)

Implements org.w3c.dom.Element.removeAttributeNS.

Introduced in DOM Level 2.

pack-priv void
rename(String name)

public void
setAttribute(String
The name of the attribute to create or alter.
name
,
String
Value to set in string form.
value
)

Implements org.w3c.dom.Element.setAttribute.

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

public Attr
setAttributeNode(Attr
The Attr node to add to the attribute list.
newAttr
)

Implements org.w3c.dom.Element.setAttributeNode.

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

public Attr

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.
setAttributeNodeNS
(Attr
The Attr node to add to the attribute list. When the Node has no namespaceURI, this method behaves like setAttributeNode.
newAttr
)

Implements org.w3c.dom.Element.setAttributeNodeNS.

Introduced in DOM Level 2.

public void
setAttributeNS(String
The namespace URI of the attribute to create or alter.
namespaceURI
,
String
The qualified name of the attribute to create or alter.
qualifiedName
,
String
The value to set in string form.
value
)

Implements org.w3c.dom.Element.setAttributeNS.

Introduced in DOM Level 2.

public void
setIdAttribute(String
The name of the attribute.
name
,
boolean
Whether the attribute is a of type ID.
makeId
)

Implements org.w3c.dom.Element.setIdAttribute.

DOM Level 3: register the given attribute node as an ID attribute

public void
setIdAttributeNode(Attr
The attribute node.
at
,
boolean
Whether the attribute is a of type ID.
makeId
)

Implements org.w3c.dom.Element.setIdAttributeNode.

DOM Level 3: register the given attribute node as an ID attribute

public void
setIdAttributeNS(String
The namespace URI of the attribute.
namespaceURI
,
String
The local name of the attribute.
localName
,
boolean
Whether the attribute is a of type ID.
makeId
)

Implements org.w3c.dom.Element.setIdAttributeNS.

DOM Level 3: register the given attribute node as an ID attribute

protected void
setOwnerDocument(CoreDocumentImpl doc)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.setOwnerDocument.

NON-DOM set the ownerDocument of this node, its children, and its attributes

public void
setReadOnly(boolean
True or false as desired.
readOnly
,
boolean
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.
deep
)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.setReadOnly.

NON-DOM: Subclassed to flip the attributes' readonly switch as well.

protected void
setupDefaultAttributes()

Setup the default attributes.

protected int
setXercesAttributeNode(Attr attr)

NON-DOM: sets attribute node for this element

protected void
synchronizeData()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.synchronizeData.

Synchronizes the data (name and value) for fast nodes.

Inherited from com.sun.org.apache.xerces.internal.dom.ParentNode:
checkNormalizationAfterInsertcheckNormalizationAfterRemovegetChildNodesgetChildNodesUnoptimizedgetFirstChildgetLastChildgetLengthgetOwnerDocumentgetTextContentgetTextContenthasChildNodeshasTextContentinsertBeforeinternalInsertBeforeinternalRemoveChilditemlastChildlastChildownerDocumentremoveChildreplaceChildsetTextContentsynchronizeChildren

Field Detail

attributesback to summary
protected AttributeMap attributes

Attributes.

nameback to summary
protected String name

Element name.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides com.sun.org.apache.xerces.internal.dom.ParentNode.serialVersionUID.

Serialization version.

Constructor Detail

ElementImplback to summary
public ElementImpl(CoreDocumentImpl ownerDoc, String name)

Factory constructor.

ElementImplback to summary
protected ElementImpl()

Method Detail

cloneNodeback to summary
public Node cloneNode(boolean deep)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.cloneNode.

Implements org.w3c.dom.Node.cloneNode.

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.

Parameters
deep:boolean

Doc from org.w3c.dom.Node.cloneNode.

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:Node

Doc from org.w3c.dom.Node.cloneNode.

The duplicate node.

Annotations
@Override
See Also
org.w3c.dom.Node#cloneNode(boolean)
getAttributeback to summary
public String getAttribute(String name)

Implements org.w3c.dom.Element.getAttribute.

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().

Parameters
name:String

Doc from org.w3c.dom.Element.getAttribute.

The name of the attribute to retrieve.

Returns:String

Doc from org.w3c.dom.Element.getAttribute.

The Attr value as a string, or the empty string if that attribute does not have a specified or default value.

getAttributeNodeback to summary
public Attr getAttributeNode(String name)

Implements org.w3c.dom.Element.getAttributeNode.

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.

Parameters
name:String

Doc from org.w3c.dom.Element.getAttributeNode.

The name (nodeName) of the attribute to retrieve.

Returns:Attr

Doc from org.w3c.dom.Element.getAttributeNode.

The Attr node with the specified name ( nodeName) or null if there is no such attribute.

getAttributeNodeNSback to summary
public Attr getAttributeNodeNS(String namespaceURI, String localName)

Implements org.w3c.dom.Element.getAttributeNodeNS.

Retrieves an Attr node by local name and namespace URI.

Parameters
namespaceURI:String

The namespace URI of the attribute to retrieve.

localName:String

The local name of the attribute to retrieve.

Returns:Attr

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
getAttributeNSback to summary
public String getAttributeNS(String namespaceURI, String localName)

Implements org.w3c.dom.Element.getAttributeNS.

Introduced in DOM Level 2.

Retrieves an attribute value by local name and namespace URI.

Parameters
namespaceURI:String

The namespace URI of the attribute to retrieve.

localName:String

The local name of the attribute to retrieve.

Returns:String

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
getAttributesback to summary
public NamedNodeMap getAttributes()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.getAttributes.

Implements org.w3c.dom.Node.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.

Returns:NamedNodeMap

all Attributes

Annotations
@Override
getBaseURIback to summary
public String getBaseURI()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.getBaseURI.

Implements org.w3c.dom.Node.getBaseURI.

DOM Level 3 WD - Experimental. Retrieve baseURI

Returns:String

the baseURI

Annotations
@Override
getChildElementCountback to summary
public final int getChildElementCount()

Implements org.w3c.dom.ElementTraversal.getChildElementCount.

Doc from org.w3c.dom.ElementTraversal.getChildElementCount.

Returns the current number of child nodes of the element which are of the Element type.

Returns:int

the number of element children, or 0 if the element has no element children.

Annotations
@Override
See Also
Element Traversal Specification
getDefaultAttributesback to summary
protected NamedNodeMapImpl getDefaultAttributes()

Get the default attributes.

getElementsByTagNameback to summary
public NodeList getElementsByTagName(String tagname)

Implements org.w3c.dom.Element.getElementsByTagName.

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.

Parameters
tagname:String

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:NodeList

Doc from org.w3c.dom.Element.getElementsByTagName.

A list of matching Element nodes.

See Also
DeepNodeListImpl
getElementsByTagNameNSback to summary
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)

Implements org.w3c.dom.Element.getElementsByTagNameNS.

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.

Parameters
namespaceURI:String

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:String

The local name of the elements to match on. The special value "*" matches all local names.

Returns:NodeList

NodeList A new NodeList object containing all the matched Elements.

Since
WD-DOM-Level-2-19990923
getFirstElementChildback to summary
public final Element getFirstElementChild()

Implements org.w3c.dom.ElementTraversal.getFirstElementChild.

Doc from org.w3c.dom.ElementTraversal.getFirstElementChild.

Returns a reference to the first child node of the element which is of the Element type.

Returns:Element

a reference to an element child, null if the element has no child of the Element type.

Annotations
@Override
See Also
Element Traversal Specification
getFirstElementChildback to summary
private Element getFirstElementChild(Node n)
getLastElementChildback to summary
public final Element getLastElementChild()

Implements org.w3c.dom.ElementTraversal.getLastElementChild.

Doc from org.w3c.dom.ElementTraversal.getLastElementChild.

Returns a reference to the last child node of the element which is of the Element type.

Returns:Element

a reference to an element child, null if the element has no child of the Element type.

Annotations
@Override
See Also
Element Traversal Specification
getLastElementChildback to summary
private Element getLastElementChild(Node n)
getNextElementSiblingback to summary
public final Element getNextElementSibling()

Implements org.w3c.dom.ElementTraversal.getNextElementSibling.

Doc from org.w3c.dom.ElementTraversal.getNextElementSibling.

Returns a reference to the sibling node of the element which most immediately follows the element in document order, and which is of the Element type.

Returns:Element

a reference to an element child, null if the element has no sibling node of the Element type that comes after this one.

Annotations
@Override
See Also
Element Traversal Specification
getNextLogicalSiblingback to summary
private Node getNextLogicalSibling(Node n)
getNodeNameback to summary
public String getNodeName()

Implements abstract com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeName.

Implements org.w3c.dom.Node.getNodeName.

Returns the node name

Returns:String

the node name

Annotations
@Override
getNodeTypeback to summary
public short getNodeType()

Implements abstract com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeType.

Implements org.w3c.dom.Node.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.

getPreviousElementSiblingback to summary
public final Element getPreviousElementSibling()

Implements org.w3c.dom.ElementTraversal.getPreviousElementSibling.

Doc from org.w3c.dom.ElementTraversal.getPreviousElementSibling.

Returns a reference to the sibling node of the element which most immediately precedes the element in document order, and which is of the Element type.

Returns:Element

a reference to an element child, null if the element has no sibling node of the Element type that comes before this one.

Annotations
@Override
See Also
Element Traversal Specification
getPreviousLogicalSiblingback to summary
private Node getPreviousLogicalSibling(Node n)
getSchemaTypeInfoback to summary
public TypeInfo getSchemaTypeInfo()

Implements org.w3c.dom.Element.getSchemaTypeInfo.

Method getSchemaTypeInfo.

Returns:TypeInfo

TypeInfo

getTagNameback to summary
public String getTagName()

Implements org.w3c.dom.Element.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.

getTypeNameback to summary
public String getTypeName()

Implements org.w3c.dom.TypeInfo.getTypeName.

Doc from org.w3c.dom.TypeInfo.getTypeName.

The name of a type declared for the associated element or attribute, or null if unknown.

See Also
org.w3c.dom.TypeInfo#getTypeName()
getTypeNamespaceback to summary
public String getTypeNamespace()

Implements org.w3c.dom.TypeInfo.getTypeNamespace.

Doc from org.w3c.dom.TypeInfo.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.

See Also
org.w3c.dom.TypeInfo#getTypeNamespace()
getXercesAttributeback to summary
protected int getXercesAttribute(String namespaceURI, String localName)

NON-DOM: get inded of an attribute

getXMLBaseAttributeback to summary
protected Attr getXMLBaseAttribute()

NON-DOM Returns the xml:base attribute.

Returns:Attr

the xml:base attribute

hasAttributeback to summary
public boolean hasAttribute(String name)

Implements org.w3c.dom.Element.hasAttribute.

Introduced in DOM Level 2.

Parameters
name:String

Doc from org.w3c.dom.Element.hasAttribute.

The name of the attribute to look for.

Returns:boolean

Doc from org.w3c.dom.Element.hasAttribute.

true if an attribute with the given name is specified on this element or has a default value, false otherwise.

hasAttributeNSback to summary
public boolean hasAttributeNS(String namespaceURI, String localName)

Implements org.w3c.dom.Element.hasAttributeNS.

Introduced in DOM Level 2.

Parameters
namespaceURI:String

Doc from org.w3c.dom.Element.hasAttributeNS.

The namespace URI of the attribute to look for.

localName:String

Doc from org.w3c.dom.Element.hasAttributeNS.

The local name of the attribute to look for.

Returns:boolean

Doc from org.w3c.dom.Element.hasAttributeNS.

true if an attribute with the given local name and namespace URI is specified or has a default value on this element, false otherwise.

hasAttributesback to summary
public boolean hasAttributes()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.hasAttributes.

Implements org.w3c.dom.Node.hasAttributes.

Introduced in DOM Level 2.

Returns:boolean

Doc from org.w3c.dom.Node.hasAttributes.

Returns true if this node has any attributes, false otherwise.

isDerivedFromback to summary
public boolean isDerivedFrom(String typeNamespaceArg, String typeNameArg, int derivationMethod)

Implements org.w3c.dom.TypeInfo.isDerivedFrom.

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

Parameters
typeNamespaceArg:String

The namspace of the ancestor type declaration

typeNameArg:String

The name of the ancestor type declaration

derivationMethod:int

The derivation method

Returns:boolean

boolean True if the type is derived by restriction for the reference type

isEqualNodeback to summary
public boolean isEqualNode(Node arg)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.isEqualNode.

Implements org.w3c.dom.Node.isEqualNode.

DOM Level 3 WD- Experimental. Override inherited behavior from NodeImpl and ParentNode to check on attributes

Parameters
arg:Node

Doc from org.w3c.dom.Node.isEqualNode.

The node to compare equality with.

Returns:boolean

Doc from org.w3c.dom.Node.isEqualNode.

Returns true if the nodes are equal, false otherwise.

moveSpecifiedAttributesback to summary
pack-priv void moveSpecifiedAttributes(ElementImpl el)
normalizeback to summary
public void normalize()

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.normalize.

Implements org.w3c.dom.Node.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.

reconcileDefaultAttributesback to summary
protected void reconcileDefaultAttributes()

Reconcile default attributes.

removeAttributeback to summary
public void removeAttribute(String name)

Implements org.w3c.dom.Element.removeAttribute.

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.

Parameters
name:String

Doc from org.w3c.dom.Element.removeAttribute.

The name of the attribute to remove.

Exceptions
NO_MODIFICATION_ALLOWED_ERR:
if the node is readonly.
removeAttributeNodeback to summary
public Attr removeAttributeNode(Attr oldAttr) throws DOMException

Implements org.w3c.dom.Element.removeAttributeNode.

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().

Parameters
oldAttr:Attr

Doc from org.w3c.dom.Element.removeAttributeNode.

The Attr node to remove from the attribute list.

Returns:Attr

the Attribute object that was removed.

Exceptions
DOMException:

Doc from org.w3c.dom.Element.removeAttributeNode.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if oldAttr is not an attribute of the element.

NOT_FOUND_ERR:
if oldattr is not an attribute of this Element.
NO_MODIFICATION_ALLOWED_ERR:
if the node is readonly.
removeAttributeNSback to summary
public void removeAttributeNS(String namespaceURI, String localName)

Implements org.w3c.dom.Element.removeAttributeNS.

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.

Parameters
namespaceURI:String

The namespace URI of the attribute to remove.

localName:String

The local name of the attribute to remove.

Exceptions
NO_MODIFICATION_ALLOWED_ERR:
Raised if this node is readonly.
Since
WD-DOM-Level-2-19990923
renameback to summary
pack-priv void rename(String name)
setAttributeback to summary
public void setAttribute(String name, String value)

Implements org.w3c.dom.Element.setAttribute.

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.

Parameters
name:String

Doc from org.w3c.dom.Element.setAttribute.

The name of the attribute to create or alter.

value:String

Doc from org.w3c.dom.Element.setAttribute.

Value to set in string form.

Exceptions
INVALID_CHARACTER_ERR:
if the name is not acceptable. (Attribute factory will do that test for us.)
NO_MODIFICATION_ALLOWED_ERR:
if the node is readonly.
setAttributeNodeback to summary
public Attr setAttributeNode(Attr newAttr) throws DOMException

Implements org.w3c.dom.Element.setAttributeNode.

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.

Parameters
newAttr:Attr

Doc from org.w3c.dom.Element.setAttributeNode.

The Attr node to add to the attribute list.

Returns:Attr

Doc from org.w3c.dom.Element.setAttributeNode.

If the newAttr attribute replaces an existing attribute, the replaced Attr node is returned, otherwise null is returned.

Exceptions
DOMException:

Doc from org.w3c.dom.Element.setAttributeNode.

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.

INUSE_ATTRIBUTE_ERR:
if the Attribute object has already been assigned to another Element.
setAttributeNodeNSback to summary
public Attr setAttributeNodeNS(Attr newAttr) throws DOMException

Implements org.w3c.dom.Element.setAttributeNodeNS.

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.

Parameters
newAttr:Attr

The Attr node to add to the attribute list. When the Node has no namespaceURI, this method behaves like setAttributeNode.

Returns:Attr

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.

Exceptions
DOMException:

Doc from org.w3c.dom.Element.setAttributeNodeNS.

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]).

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.
Since
WD-DOM-Level-2-19990923
setAttributeNSback to summary
public void setAttributeNS(String namespaceURI, String qualifiedName, String value)

Implements org.w3c.dom.Element.setAttributeNS.

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.

Parameters
namespaceURI:String

The namespace URI of the attribute to create or alter.

qualifiedName:String

The qualified name of the attribute to create or alter.

value:String

The value to set in string form.

Exceptions
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
setIdAttributeback to summary
public void setIdAttribute(String name, boolean makeId)

Implements org.w3c.dom.Element.setIdAttribute.

DOM Level 3: register the given attribute node as an ID attribute

Parameters
name:String

Doc from org.w3c.dom.Element.setIdAttribute.

The name of the attribute.

makeId:boolean

Doc from org.w3c.dom.Element.setIdAttribute.

Whether the attribute is a of type ID.

setIdAttributeNodeback to summary
public void setIdAttributeNode(Attr at, boolean makeId)

Implements org.w3c.dom.Element.setIdAttributeNode.

DOM Level 3: register the given attribute node as an ID attribute

Parameters
at:Attr

Doc from org.w3c.dom.Element.setIdAttributeNode.

The attribute node.

makeId:boolean

Doc from org.w3c.dom.Element.setIdAttributeNode.

Whether the attribute is a of type ID.

setIdAttributeNSback to summary
public void setIdAttributeNS(String namespaceURI, String localName, boolean makeId)

Implements org.w3c.dom.Element.setIdAttributeNS.

DOM Level 3: register the given attribute node as an ID attribute

Parameters
namespaceURI:String

Doc from org.w3c.dom.Element.setIdAttributeNS.

The namespace URI of the attribute.

localName:String

Doc from org.w3c.dom.Element.setIdAttributeNS.

The local name of the attribute.

makeId:boolean

Doc from org.w3c.dom.Element.setIdAttributeNS.

Whether the attribute is a of type ID.

setOwnerDocumentback to summary
protected void setOwnerDocument(CoreDocumentImpl doc)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.setOwnerDocument.

NON-DOM set the ownerDocument of this node, its children, and its attributes

Annotations
@Override
setReadOnlyback to summary
public void setReadOnly(boolean readOnly, boolean deep)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.setReadOnly.

NON-DOM: Subclassed to flip the attributes' readonly switch as well.

Parameters
readOnly:boolean

Doc from com.sun.org.apache.xerces.internal.dom.NodeImpl.setReadOnly.

True or false as desired.

deep:boolean

Doc from com.sun.org.apache.xerces.internal.dom.NodeImpl.setReadOnly.

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
setupDefaultAttributesback to summary
protected void setupDefaultAttributes()

Setup the default attributes.

setXercesAttributeNodeback to summary
protected int setXercesAttributeNode(Attr attr)

NON-DOM: sets attribute node for this element

synchronizeDataback to summary
protected void synchronizeData()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.synchronizeData.

Synchronizes the data (name and value) for fast nodes.