Top Description Fields Constructors Methods
org.apache.xerces.dom

public Class AttrImpl

extends NodeImpl
implements Attr, TypeInfo
Class Inheritance
All Implemented Interfaces
org.w3c.dom.TypeInfo, org.w3c.dom.Attr, org.w3c.dom.Node
Known Direct Subclasses
org.apache.xerces.dom.AttrNSImpl, org.apache.xerces.dom.DeferredAttrImpl
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, org.w3c.dom.Attr, .DOMException, .Element, .Node, .NodeList, .Text, .TypeInfo

Attribute represents an XML-style attribute of an Element. Typically, the allowable values are controlled by its declaration in the Document Type Definition (DTD) governing this kind of document.

If the attribute has not been explicitly assigned a value, but has been declared in the DTD, it will exist and have that default. Only if neither the document nor the DTD specifies a value will the Attribute really be considered absent and have no value; in that case, querying the attribute will return null.

Attributes may have multiple children that contain their data. (XML allows attributes to contain entity references, and tokenized attribute types such as NMTOKENS may have a child for each token.) For convenience, the Attribute object's getValue() method returns the string version of the attribute's value.

Attributes are not children of the Elements they belong to, in the usual sense, and have no valid Parent reference. However, the spec says they _do_ belong to a specific Element, and an INUSE exception is to be thrown if the user attempts to explicitly share them between elements.

Note that Elements do not permit attributes to appear to be shared (see the INUSE exception), so this object's mutability is officially not an issue.

Note

The ownerNode attribute is used to store the Element the Attr node is associated with. Attr nodes do not have parent nodes. Besides, the getOwnerElement() method can be used to get the element node this attribute is associated with.

AttrImpl does not support Namespaces. AttrNSImpl, which inherits from it, does.

AttrImpl used to inherit from ParentNode. It now directly inherits from NodeImpl and provide its own implementation of the ParentNode's behavior. The reason is that we now try and avoid to always create a Text node to hold the value of an attribute. The DOM spec requires it, so we still have to do it in case getFirstChild() is called for instance. The reason attribute values are stored as a list of nodes is so that they can carry more than a simple string. They can also contain EntityReference nodes. However, most of the times people only have a single string that they only set and get through Element.set/getAttribute or Attr.set/getValue. In this new version, the Attr node has a value pointer which can either be the String directly or a pointer to the first ChildNode. A flag tells which one it currently is. Note that while we try to stick with the direct String as much as possible once we've switched to a node there is no going back. This is because we have no way to know whether the application keeps referring to the node we once returned.

The gain in memory varies on the density of attributes in the document. But in the tests I've run I've seen up to 12% of memory gain. And the good thing is that it also leads to a slight gain in speed because we allocate fewer objects! I mean, that's until we have to actually create the node...

To avoid too much duplicated code, I got rid of ParentNode and renamed ChildAndParentNode, which I never really liked, to ParentNode for simplicity, this doesn't make much of a difference in memory usage because there are only very few objects that are only a Parent. This is only true now because AttrImpl now inherits directly from NodeImpl and has its own implementation of the ParentNode's node behavior. So there is still some duplicated code there.

This class doesn't directly support mutation events, however, it notifies the document when mutations are performed so that the document class do so.

Warning

Some of the code here is partially duplicated in ParentNode, be careful to keep these two classes in sync!

Authors
Arnaud Le Hors, IBM, Joe Kesselman, IBM, Andy Clark, IBM
Since
PR-DOM-Level-1-19980818.
Version
$Id: AttrImpl.java 924245 2010-03-17 11:58:14Z mrglavas $
See Also
AttrNSImpl

Field Summary

Modifier and TypeField and Description
pack-priv static final String
DTD_URI

DTD namespace.

protected String
name

Attribute name.

pack-priv static final long
pack-priv transient Object
type

Type information

protected Object
value

This can either be a String or the first child node.

Inherited from org.apache.xerces.dom.NodeImpl:
DOCUMENT_POSITION_CONTAINSDOCUMENT_POSITION_DISCONNECTEDDOCUMENT_POSITION_FOLLOWINGDOCUMENT_POSITION_IMPLEMENTATION_SPECIFICDOCUMENT_POSITION_IS_CONTAINEDDOCUMENT_POSITION_PRECEDINGELEMENT_DEFINITION_NODEFIRSTCHILDflagsHASSTRINGIDIGNORABLEWSNORMALIZEDOWNEDownerNodeREADONLYSPECIFIEDSYNCCHILDRENSYNCDATATREE_POSITION_ANCESTORTREE_POSITION_DESCENDANTTREE_POSITION_DISCONNECTEDTREE_POSITION_EQUIVALENTTREE_POSITION_FOLLOWINGTREE_POSITION_PRECEDINGTREE_POSITION_SAME_NODE

Constructor Summary

AccessConstructor and Description
protected
AttrImpl(CoreDocumentImpl ownerDocument, String name)

Attribute has no public constructor.

protected

Method Summary

Modifier and TypeMethod and Description
pack-priv void
checkNormalizationAfterInsert(ChildNode
the child node that was inserted into this node
insertedChild
)

Checks the normalized state of this node after inserting a child.

pack-priv void
checkNormalizationAfterRemove(ChildNode
the previous sibling of the removed child, or null
previousSibling
)

Checks the normalized of this node after removing a child.

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 org.apache.xerces.dom.NodeImpl.cloneNode.

Implements org.w3c.dom.Node.cloneNode.

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
public NodeList
getChildNodes()

Overrides org.apache.xerces.dom.NodeImpl.getChildNodes.

Implements org.w3c.dom.Node.getChildNodes.

Obtain a NodeList enumerating all children of this node.
public Element
getElement()

Deprecated Previous working draft of DOM Level 2. New method is getOwnerElement().
Returns the element node that this attribute is associated with, or null if the attribute has not been added to an element.
public Node
getFirstChild()

Overrides org.apache.xerces.dom.NodeImpl.getFirstChild.

Implements org.w3c.dom.Node.getFirstChild.

The first child of this Node, or null if none.
public Node
getLastChild()

Overrides org.apache.xerces.dom.NodeImpl.getLastChild.

Implements org.w3c.dom.Node.getLastChild.

The last child of this Node, or null if none.
public int

Returns:

int
getLength
()

Overrides org.apache.xerces.dom.NodeImpl.getLength.

Implements org.w3c.dom.NodeList.getLength.

NodeList method: Count the immediate children of this node
public String
getName()

Implements org.w3c.dom.Attr.getName.

In Attributes, NodeName is considered a synonym for the attribute's Name
public String
getNodeName()

Implements abstract org.apache.xerces.dom.NodeImpl.getNodeName.

Implements org.w3c.dom.Node.getNodeName.

Returns the attribute name
public short
getNodeType()

Implements abstract org.apache.xerces.dom.NodeImpl.getNodeType.

Implements org.w3c.dom.Node.getNodeType.

A short integer indicating what type of node this is.
public String
getNodeValue()

Overrides org.apache.xerces.dom.NodeImpl.getNodeValue.

Implements org.w3c.dom.Node.getNodeValue.

In Attribute objects, NodeValue is considered a synonym for Value.
public Element
getOwnerElement()

Implements org.w3c.dom.Attr.getOwnerElement.

Returns the element node that this attribute is associated with, or null if the attribute has not been added to an element.
public TypeInfo

Returns:

TypeInfo
getSchemaTypeInfo
()

Implements org.w3c.dom.Attr.getSchemaTypeInfo.

Method getSchemaTypeInfo.
public boolean
getSpecified()

Implements org.w3c.dom.Attr.getSpecified.

The "specified" flag is true if and only if this attribute's value was explicitly specified in the original document.
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.
public String
getValue()

Implements org.w3c.dom.Attr.getValue.

The "string value" of an Attribute is its text representation, which in turn is a concatenation of the string values of its children.
public boolean
hasChildNodes()

Overrides org.apache.xerces.dom.NodeImpl.hasChildNodes.

Implements org.w3c.dom.Node.hasChildNodes.

Test whether this node has any children.
public Node

Returns:

newChild, in its new state (relocated, or emptied in the case of DocumentNode.)
insertBefore
(Node
The Node to be moved to our subtree. As a convenience feature, inserting a DocumentNode will instead insert all its children.
newChild
,
Node
Current child which newChild should be placed immediately before. If refChild is null, the insertion occurs after all existing Nodes, like appendChild().
refChild
)

Overrides org.apache.xerces.dom.NodeImpl.insertBefore.

Implements org.w3c.dom.Node.insertBefore.

Move one or more node(s) to our list of children.
pack-priv Node
internalInsertBefore(Node newChild, Node refChild, boolean replace)

NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able to control which mutation events are spawned.

pack-priv Node
internalRemoveChild(Node oldChild, boolean replace)

NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able to control which mutation events are spawned.

public boolean

Returns:

boolean True if the type is derived by restriciton 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 org.apache.xerces.dom.NodeImpl.isEqualNode.

Implements org.w3c.dom.Node.isEqualNode.

DOM Level 3 WD- Experimental.
public boolean
isId()

Implements org.w3c.dom.Attr.isId.

DOM Level 3: isId
public Node

Returns:

org.w3c.dom.Node
item
(int
int
index
)

Overrides org.apache.xerces.dom.NodeImpl.item.

Implements org.w3c.dom.NodeList.item.

NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds.
pack-priv final ChildNode
pack-priv final void
protected void
public void
normalize()

Overrides org.apache.xerces.dom.NodeImpl.normalize.

Implements org.w3c.dom.Node.normalize.

Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
private void
readObject(ObjectInputStream ois)

Deserialize object.

public Node

Returns:

oldChild, in its new state (removed).
removeChild
(Node
The node being removed.
oldChild
)

Overrides org.apache.xerces.dom.NodeImpl.removeChild.

Implements org.w3c.dom.Node.removeChild.

Remove a child from this Node.
pack-priv void
rename(String name)

public Node

Returns:

oldChild, in its new state (removed).
replaceChild
(Node
The new node to put in the child list.
newChild
,
Node
The node being replaced in the list.
oldChild
)

Overrides org.apache.xerces.dom.NodeImpl.replaceChild.

Implements org.w3c.dom.Node.replaceChild.

Make newChild occupy the location that oldChild used to have.
public void
setIdAttribute(boolean id)

NON-DOM: set the type of this attribute to be ID type.

public void
setNodeValue(String value)

Overrides org.apache.xerces.dom.NodeImpl.setNodeValue.

Implements org.w3c.dom.Node.setNodeValue.

Implicit in the rerouting of getNodeValue to getValue is the need to redefine setNodeValue, for symmetry's sake.
protected void
setOwnerDocument(CoreDocumentImpl doc)

Overrides org.apache.xerces.dom.NodeImpl.setOwnerDocument.

NON-DOM set the ownerDocument of this node and its children
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 org.apache.xerces.dom.NodeImpl.setReadOnly.

Override default behavior so that if deep is true, children are also toggled.
public void
setSpecified(boolean arg)

NON-DOM, for use by parser

public void
setType(Object type)

NON-DOM: used by the parser

public void
setValue(String newvalue)

Implements org.w3c.dom.Attr.setValue.

The DOM doesn't clearly define what setValue(null) means.
protected void
synchronizeChildren()

Override this method in subclass to hook in efficient internal data structure.

public String
toString()

Overrides org.apache.xerces.dom.NodeImpl.toString.

NON-DOM method for debugging convenience
private void
Inherited from org.apache.xerces.dom.NodeImpl:
addEventListenerappendChildchangedchangescompareDocumentPositioncompareTreePositiondispatchEventgetAttributesgetBaseURIgetContainergetElementAncestorgetFeaturegetLocalNamegetNamespaceURIgetNextSiblinggetNodeNumbergetOwnerDocumentgetParentNodegetPrefixgetPreviousSiblinggetReadOnlygetTextContentgetTextContentgetUserDatagetUserDatagetUserDataRecordhasAttributeshasStringValuehasStringValueinternalIsIgnorableWhitespaceisDefaultNamespaceisFirstChildisFirstChildisIdAttributeisIdAttributeisIgnorableWhitespaceisNormalizedisNormalizedisOwnedisOwnedisReadOnlyisReadOnlyisSameNodeisSpecifiedisSpecifiedisSupportedlookupNamespacePrefixlookupNamespaceURIlookupPrefixneedsSyncChildrenneedsSyncChildrenneedsSyncDataneedsSyncDataownerDocumentparentNodepreviousSiblingremoveEventListenersetPrefixsetTextContentsetUserDatasetUserDatasynchronizeData

Field Detail

DTD_URIback to summary
pack-priv static final String DTD_URI

DTD namespace.

nameback to summary
protected String name

Attribute name.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides org.apache.xerces.dom.NodeImpl.serialVersionUID.

Serialization version.

typeback to summary
pack-priv transient Object type

Type information

valueback to summary
protected Object value

This can either be a String or the first child node.

Constructor Detail

AttrImplback to summary
protected AttrImpl(CoreDocumentImpl ownerDocument, String name)

Attribute has no public constructor. Please use the factory method in the Document class.

AttrImplback to summary
protected AttrImpl()

Method Detail

checkNormalizationAfterInsertback to summary
pack-priv void checkNormalizationAfterInsert(ChildNode insertedChild)

Checks the normalized state of this node after inserting a child. If the inserted child causes this node to be unnormalized, then this node is flagged accordingly. The conditions for changing the normalized state are:

  • The inserted child is a text node and one of its adjacent siblings is also a text node.
  • The inserted child is is itself unnormalized.
Parameters
insertedChild:ChildNode

the child node that was inserted into this node

Exceptions
NullPointerException:
if the inserted child is null
checkNormalizationAfterRemoveback to summary
pack-priv void checkNormalizationAfterRemove(ChildNode previousSibling)

Checks the normalized of this node after removing a child. If the removed child causes this node to be unnormalized, then this node is flagged accordingly. The conditions for changing the normalized state are:

  • The removed child had two adjacent siblings that were text nodes.
Parameters
previousSibling:ChildNode

the previous sibling of the removed child, or null

cloneNodeback to summary
public Node cloneNode(boolean deep)

Overrides org.apache.xerces.dom.NodeImpl.cloneNode.

Implements org.w3c.dom.Node.cloneNode.

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

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent ( parentNode is null) and no user data. User data associated to the imported node is not carried over. However, if any UserDataHandlers has been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.
Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any children it contains unless it is a deep clone. This includes text contained in an the Element since the text is contained in a child Text node. Cloning an Attr directly, as opposed to be cloned as part of an Element cloning operation, returns a specified attribute (specified is true). Cloning an Attr always clones its children, since they represent its value, no matter whether this is a deep clone or not. Cloning an EntityReference automatically constructs its subtree if a corresponding Entity is available, no matter whether this is a deep clone or not. Cloning any other type of node simply returns a copy of this node.
Note that cloning an immutable subtree results in a mutable copy, but the children of an EntityReference clone are readonly . In addition, clones of unspecified Attr nodes are specified. And, cloning Document, DocumentType, Entity, and Notation nodes is implementation dependent.

Parameters
deep: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).

Returns:Node

The duplicate node.

getChildNodesback to summary
public NodeList getChildNodes()

Overrides org.apache.xerces.dom.NodeImpl.getChildNodes.

Implements org.w3c.dom.Node.getChildNodes.

Obtain a NodeList enumerating all children of this node. If there are none, an (initially) empty NodeList is returned.

NodeLists are "live"; as children are added/removed the NodeList will immediately reflect those changes. Also, the NodeList refers to the actual nodes, so changes to those nodes made via the DOM tree will be reflected in the NodeList and vice versa.

In this implementation, Nodes implement the NodeList interface and provide their own getChildNodes() support. Other DOMs may solve this differently.

getElementback to summary
public Element getElement()

Deprecated

Previous working draft of DOM Level 2. New method is getOwnerElement().

Returns the element node that this attribute is associated with, or null if the attribute has not been added to an element.

See Also
getOwnerElement
getFirstChildback to summary
public Node getFirstChild()

Overrides org.apache.xerces.dom.NodeImpl.getFirstChild.

Implements org.w3c.dom.Node.getFirstChild.

The first child of this Node, or null if none.

getLastChildback to summary
public Node getLastChild()

Overrides org.apache.xerces.dom.NodeImpl.getLastChild.

Implements org.w3c.dom.Node.getLastChild.

The last child of this Node, or null if none.

getLengthback to summary
public int getLength()

Overrides org.apache.xerces.dom.NodeImpl.getLength.

Implements org.w3c.dom.NodeList.getLength.

NodeList method: Count the immediate children of this node

Returns:int

int

getNameback to summary
public String getName()

Implements org.w3c.dom.Attr.getName.

In Attributes, NodeName is considered a synonym for the attribute's Name

getNodeNameback to summary
public String getNodeName()

Implements abstract org.apache.xerces.dom.NodeImpl.getNodeName.

Implements org.w3c.dom.Node.getNodeName.

Returns the attribute name

getNodeTypeback to summary
public short getNodeType()

Implements abstract org.apache.xerces.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.

getNodeValueback to summary
public String getNodeValue()

Overrides org.apache.xerces.dom.NodeImpl.getNodeValue.

Implements org.w3c.dom.Node.getNodeValue.

In Attribute objects, NodeValue is considered a synonym for Value.

See Also
getValue()
getOwnerElementback to summary
public Element getOwnerElement()

Implements org.w3c.dom.Attr.getOwnerElement.

Returns the element node that this attribute is associated with, or null if the attribute has not been added to an element.

Since
WD-DOM-Level-2-19990719
getSchemaTypeInfoback to summary
public TypeInfo getSchemaTypeInfo()

Implements org.w3c.dom.Attr.getSchemaTypeInfo.

Method getSchemaTypeInfo.

Returns:TypeInfo

TypeInfo

getSpecifiedback to summary
public boolean getSpecified()

Implements org.w3c.dom.Attr.getSpecified.

The "specified" flag is true if and only if this attribute's value was explicitly specified in the original document. Note that the implementation, not the user, is in charge of this property. If the user asserts an Attribute value (even if it ends up having the same value as the default), it is considered a specified attribute. If you really want to revert to the default, delete the attribute from the Element, and the Implementation will re-assert the default (if any) in its place, with the appropriate specified=false setting.

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()
getValueback to summary
public String getValue()

Implements org.w3c.dom.Attr.getValue.

The "string value" of an Attribute is its text representation, which in turn is a concatenation of the string values of its children.

hasChildNodesback to summary
public boolean hasChildNodes()

Overrides org.apache.xerces.dom.NodeImpl.hasChildNodes.

Implements org.w3c.dom.Node.hasChildNodes.

Test whether this node has any children. Convenience shorthand for (Node.getFirstChild()!=null)

Returns:boolean

Doc from org.w3c.dom.Node.hasChildNodes.

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

insertBeforeback to summary
public Node insertBefore(Node newChild, Node refChild) throws DOMException

Overrides org.apache.xerces.dom.NodeImpl.insertBefore.

Implements org.w3c.dom.Node.insertBefore.

Move one or more node(s) to our list of children. Note that this implicitly removes them from their previous parent.

Parameters
newChild:Node

The Node to be moved to our subtree. As a convenience feature, inserting a DocumentNode will instead insert all its children.

refChild:Node

Current child which newChild should be placed immediately before. If refChild is null, the insertion occurs after all existing Nodes, like appendChild().

Returns:Node

newChild, in its new state (relocated, or emptied in the case of DocumentNode.)

Exceptions
DOMException:

Doc from org.w3c.dom.Node.insertBefore.

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to insert a second DocumentType or Element node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the parent of the node being inserted is readonly.
NOT_FOUND_ERR: Raised if refChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document, this exception might be raised if the DOM implementation doesn't support the insertion of a DocumentType or Element node.

HIERARCHY_REQUEST_ERR:
if newChild is of a type that shouldn't be a child of this node, or if newChild is an ancestor of this node.
WRONG_DOCUMENT_ERR:
if newChild has a different owner document than we do.
NOT_FOUND_ERR:
if refChild is not a child of this node.
NO_MODIFICATION_ALLOWED_ERR:
if this node is read-only.
internalInsertBeforeback to summary
pack-priv Node internalInsertBefore(Node newChild, Node refChild, boolean replace) throws DOMException

NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able to control which mutation events are spawned. This version of the insertBefore operation allows us to do so. It is not intended for use by application programs.

internalRemoveChildback to summary
pack-priv Node internalRemoveChild(Node oldChild, boolean replace) throws DOMException

NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able to control which mutation events are spawned. This version of the removeChild operation allows us to do so. It is not intended for use by application programs.

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 restriciton for the reference type

isEqualNodeback to summary
public boolean isEqualNode(Node arg)

Overrides org.apache.xerces.dom.NodeImpl.isEqualNode.

Implements org.w3c.dom.Node.isEqualNode.

DOM Level 3 WD- Experimental. Override inherited behavior from ParentNode to support deep equal. isEqualNode is always deep on Attr nodes.

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.

isIdback to summary
public boolean isId()

Implements org.w3c.dom.Attr.isId.

DOM Level 3: isId

itemback to summary
public Node item(int index)

Overrides org.apache.xerces.dom.NodeImpl.item.

Implements org.w3c.dom.NodeList.item.

NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds.

Parameters
index:int

int

Returns:Node

org.w3c.dom.Node

lastChildback to summary
pack-priv final ChildNode lastChild()
lastChildback to summary
pack-priv final void lastChild(ChildNode node)
makeChildNodeback to summary
protected void makeChildNode()
normalizeback to summary
public void normalize()

Overrides org.apache.xerces.dom.NodeImpl.normalize.

Implements org.w3c.dom.Node.normalize.

Doc from org.w3c.dom.Node.normalize.

Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer [XPointer] lookups) that depend on a particular document tree structure are to be used. If the parameter "normalize-characters" of the DOMConfiguration object attached to the Node.ownerDocument is true, this method will also fully normalize the characters of the Text nodes.

Note

In cases where the document contains CDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes.

readObjectback to summary
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException

Deserialize object.

removeChildback to summary
public Node removeChild(Node oldChild) throws DOMException

Overrides org.apache.xerces.dom.NodeImpl.removeChild.

Implements org.w3c.dom.Node.removeChild.

Remove a child from this Node. The removed child's subtree remains intact so it may be re-inserted elsewhere.

Parameters
oldChild:Node

Doc from org.w3c.dom.Node.removeChild.

The node being removed.

Returns:Node

oldChild, in its new state (removed).

Exceptions
DOMException:

Doc from org.w3c.dom.Node.removeChild.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document, this exception might be raised if the DOM implementation doesn't support the removal of the DocumentType child or the Element child.

NOT_FOUND_ERR:
if oldChild is not a child of this node.
NO_MODIFICATION_ALLOWED_ERR:
if this node is read-only.
renameback to summary
pack-priv void rename(String name)
replaceChildback to summary
public Node replaceChild(Node newChild, Node oldChild) throws DOMException

Overrides org.apache.xerces.dom.NodeImpl.replaceChild.

Implements org.w3c.dom.Node.replaceChild.

Make newChild occupy the location that oldChild used to have. Note that newChild will first be removed from its previous parent, if any. Equivalent to inserting newChild before oldChild, then removing oldChild.

Parameters
newChild:Node

Doc from org.w3c.dom.Node.replaceChild.

The new node to put in the child list.

oldChild:Node

Doc from org.w3c.dom.Node.replaceChild.

The node being replaced in the list.

Returns:Node

oldChild, in its new state (removed).

Exceptions
DOMException:

Doc from org.w3c.dom.Node.replaceChild.

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to put in is one of this node's ancestors or this node itself, or if this node is of type Document and the result of the replacement operation would add a second DocumentType or Element on the Document node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document, this exception might be raised if the DOM implementation doesn't support the replacement of the DocumentType child or Element child.

HIERARCHY_REQUEST_ERR:
if newChild is of a type that shouldn't be a child of this node, or if newChild is one of our ancestors.
WRONG_DOCUMENT_ERR:
if newChild has a different owner document than we do.
NOT_FOUND_ERR:
if oldChild is not a child of this node.
NO_MODIFICATION_ALLOWED_ERR:
if this node is read-only.
setIdAttributeback to summary
public void setIdAttribute(boolean id)

NON-DOM: set the type of this attribute to be ID type.

setNodeValueback to summary
public void setNodeValue(String value) throws DOMException

Overrides org.apache.xerces.dom.NodeImpl.setNodeValue.

Implements org.w3c.dom.Node.setNodeValue.

Implicit in the rerouting of getNodeValue to getValue is the need to redefine setNodeValue, for symmetry's sake. Note that since we're explicitly providing a value, Specified should be set true.... even if that value equals the default.

Exceptions
DOMException:

Doc from org.w3c.dom.Node.setNodeValue.

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly and if it is not defined to be null.

setOwnerDocumentback to summary
protected void setOwnerDocument(CoreDocumentImpl doc)

Overrides org.apache.xerces.dom.NodeImpl.setOwnerDocument.

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

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

Overrides org.apache.xerces.dom.NodeImpl.setReadOnly.

Override default behavior so that if deep is true, children are also toggled.

Parameters
readOnly:boolean

Doc from org.apache.xerces.dom.NodeImpl.setReadOnly.

True or false as desired.

deep:boolean

Doc from org.apache.xerces.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
<P> Note: this will not change the state of an EntityReference or its children, which are always read-only.
setSpecifiedback to summary
public void setSpecified(boolean arg)

NON-DOM, for use by parser

setTypeback to summary
public void setType(Object type)

NON-DOM: used by the parser

setValueback to summary
public void setValue(String newvalue)

Implements org.w3c.dom.Attr.setValue.

The DOM doesn't clearly define what setValue(null) means. I've taken it as "remove all children", which from outside should appear similar to setting it to the empty string.

synchronizeChildrenback to summary
protected void synchronizeChildren()

Override this method in subclass to hook in efficient internal data structure.

toStringback to summary
public String toString()

Overrides org.apache.xerces.dom.NodeImpl.toString.

NON-DOM method for debugging convenience

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

writeObjectback to summary
private void writeObject(ObjectOutputStream out) throws IOException

Hides org.apache.xerces.dom.NodeImpl.writeObject.

Serialize object.