Top Description Fields Constructors Methods
org.dom4j.dom

public Class DOMElement

extends DefaultElement
implements Element
Class Inheritance
All Implemented Interfaces
org.w3c.dom.Element, org.w3c.dom.Node
Imports
org.dom4j.*, org.dom4j.tree.DefaultElement, org.w3c.dom.*, .Document, .Element, .Node, java.util.ArrayList, .List

DOMElement implements an XML element which supports the W3C DOM API.

Author
James Strachan
Version
$Revision: 1.23 $

Field Summary

Modifier and TypeField and Description
private static final DocumentFactory
DOCUMENT_FACTORY

Hides org.dom4j.tree.DefaultElement.DOCUMENT_FACTORY.

The DocumentFactory instance used by default

Constructor Summary

AccessConstructor and Description
public
public
public
DOMElement(QName qname, int attributeCount)

public
DOMElement(String name, Namespace namespace)

Method Summary

Modifier and TypeMethod and Description
public Node
appendChild(Node
The node to add.If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node
newChild
)

Implements org.w3c.dom.Node.appendChild.

Adds the node newChild to the end of the list of children of this node.
protected Attribute
protected Attribute
attribute(String namespaceURI, String localName)

private void
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
)

Implements org.w3c.dom.Node.cloneNode.

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
public short
compareDocumentPosition(Node
The node to compare against the reference node.
other
)

Implements org.w3c.dom.Node.compareDocumentPosition.

Compares the reference node, i.e. the node on which this method is being called, with a node, i.e. the one passed as a parameter, with regard to their position in the document and according to the document order.
protected Attribute
public String
getAttribute(String
The name of the attribute to retrieve.
name
)

Implements org.w3c.dom.Element.getAttribute.

Retrieves an attribute value by name.
public Attr
getAttributeNode(String
The name (nodeName) of the attribute to retrieve.
name
)

Implements org.w3c.dom.Element.getAttributeNode.

Retrieves an attribute node by name.
public Attr
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
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.

Retrieves an attribute value by local name and namespace URI.
public NamedNodeMap
getAttributes()

Implements org.w3c.dom.Node.getAttributes.

A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
public String
getBaseURI()

Implements org.w3c.dom.Node.getBaseURI.

The absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI.
public NodeList
getChildNodes()

Implements org.w3c.dom.Node.getChildNodes.

A NodeList that contains all children of this node.
protected DocumentFactory
public NodeList
getElementsByTagName(String
The name of the tag to match on. The special value "*" matches all tags.
name
)

Implements org.w3c.dom.Element.getElementsByTagName.

Returns a NodeList of all descendant Elements with a given tag name, in document order.
public NodeList
getElementsByTagNameNS(String
The namespace URI of the elements to match on. The special value "*" matches all namespaces.
namespace
,
String
The local name of the elements to match on. The special value "*" matches all local names.
lName
)

Implements org.w3c.dom.Element.getElementsByTagNameNS.

Returns a NodeList of all the descendant Elements with a given local name and namespace URI in document order.
public Object
getFeature(String
The name of the feature requested. Note that any plus sign "+" prepended to the name of the feature will be ignored since it is not significant in the context of this method.
feature
,
String
This is the version number of the feature to test.
version
)

Implements org.w3c.dom.Node.getFeature.

This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in .
public Node
getFirstChild()

Implements org.w3c.dom.Node.getFirstChild.

The first child of this node.
public Node
getLastChild()

Implements org.w3c.dom.Node.getLastChild.

The last child of this node.
public String
getLocalName()

Implements org.w3c.dom.Node.getLocalName.

Returns the local part of the qualified name of this node.
public String
getNamespaceURI()

Overrides org.dom4j.tree.AbstractElement.getNamespaceURI.

Implements org.w3c.dom.Node.getNamespaceURI, org.dom4j.Element.getNamespaceURI.

The namespace URI of this node, or null if it is unspecified (see ).
public Node
getNextSibling()

Implements org.w3c.dom.Node.getNextSibling.

The node immediately following this node.
public String
getNodeName()

Implements org.w3c.dom.Node.getNodeName.

The name of this node, depending on its type; see the table above.
public String
getNodeValue()

Implements org.w3c.dom.Node.getNodeValue.

The value of this node, depending on its type; see the table above.
public Document
getOwnerDocument()

Implements org.w3c.dom.Node.getOwnerDocument.

The Document object associated with this node.
public Node
getParentNode()

Implements org.w3c.dom.Node.getParentNode.

The parent of this node.
public String
getPrefix()

Implements org.w3c.dom.Node.getPrefix.

The namespace prefix of this node, or null if it is unspecified.
public Node
getPreviousSibling()

Implements org.w3c.dom.Node.getPreviousSibling.

The node immediately preceding this node.
protected QName
getQName(String namespace, String qualifiedName)

public TypeInfo
getSchemaTypeInfo()

Implements org.w3c.dom.Element.getSchemaTypeInfo.

The type information associated with this element.
public String
getTagName()

Implements org.w3c.dom.Element.getTagName.

The name of the element.
public String
getTextContent()

Implements org.w3c.dom.Node.getTextContent.

This attribute returns the text content of this node and its descendants.
public Object
getUserData(String
The key the object is associated to.
key
)

Implements org.w3c.dom.Node.getUserData.

Retrieves the object associated to a key on a this node.
public boolean
hasAttribute(String
The name of the attribute to look for.
name
)

Implements org.w3c.dom.Element.hasAttribute.

Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.
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.

Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise.
public boolean
hasAttributes()

Implements org.w3c.dom.Node.hasAttributes.

Returns whether this node (if it is an element) has any attributes.
public boolean
hasChildNodes()

Implements org.w3c.dom.Node.hasChildNodes.

Returns whether this node has any children.
public Node
insertBefore(Node
The node to insert.
newChild
,
Node
The reference node, i.e., the node before which the new node must be inserted.
refChild
)

Implements org.w3c.dom.Node.insertBefore.

Inserts the node newChild before the existing child node refChild.
public boolean
isDefaultNamespace(String
The namespace URI to look for.
namespaceURI
)

Implements org.w3c.dom.Node.isDefaultNamespace.

This method checks if the specified namespaceURI is the default namespace or not.
public boolean
isEqualNode(Node
The node to compare equality with.
other
)

Implements org.w3c.dom.Node.isEqualNode.

Tests whether two nodes are equal.
public boolean
isSameNode(Node
The node to test against.
other
)

Implements org.w3c.dom.Node.isSameNode.

Returns whether this node is the same node as the given one.
public boolean
isSupported(String
The name of the feature to test.
feature
,
String
This is the version number of the feature to test.
version
)

Implements org.w3c.dom.Node.isSupported.

Tests whether the DOM implementation implements a specific feature and that feature is supported by this node, as specified in .
public String
lookupNamespaceURI(String
The prefix to look for. If this parameter is null, the method will return the default namespace URI if any.
prefix
)

Implements org.w3c.dom.Node.lookupNamespaceURI.

Look up the namespace URI associated to the given prefix, starting from this node.
public String
lookupPrefix(String
The namespace URI to look for.
namespaceURI
)

Implements org.w3c.dom.Node.lookupPrefix.

Look up the prefix associated to the given namespace URI, starting from this node.
public void
removeAttribute(String
The name of the attribute to remove.
name
)

Implements org.w3c.dom.Element.removeAttribute.

Removes an attribute by name.
public Attr
removeAttributeNode(Attr
The Attr node to remove from the attribute list.
oldAttr
)

Implements org.w3c.dom.Element.removeAttributeNode.

Removes the specified attribute node.
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.

Removes an attribute by local name and namespace URI.
public Node
removeChild(Node
The node being removed.
oldChild
)

Implements org.w3c.dom.Node.removeChild.

Removes the child node indicated by oldChild from the list of children, and returns it.
public Node
replaceChild(Node
The new node to put in the child list.
newChild
,
Node
The node being replaced in the list.
oldChild
)

Implements org.w3c.dom.Node.replaceChild.

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
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.

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

Implements org.w3c.dom.Element.setAttributeNode.

Adds a new attribute node.
public Attr
setAttributeNodeNS(Attr
The Attr node to add to the attribute list.
newAttr
)

Implements org.w3c.dom.Element.setAttributeNodeNS.

Adds a new attribute.
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.

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

Implements org.w3c.dom.Element.setIdAttribute.

If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute .
public void
setIdAttributeNode(Attr
The attribute node.
idAttr
,
boolean
Whether the attribute is a of type ID.
isId
)

Implements org.w3c.dom.Element.setIdAttributeNode.

If the parameter isId is true, this method declares the specified attribute to be a user-determined 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.
isId
)

Implements org.w3c.dom.Element.setIdAttributeNS.

If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute .
public void
setNodeValue(String nodeValue)

Implements org.w3c.dom.Node.setNodeValue.

The value of this node, depending on its type; see the table above.
public void
setPrefix(String prefix)

Implements org.w3c.dom.Node.setPrefix.

The namespace prefix of this node, or null if it is unspecified.
public void
setTextContent(String textContent)

Implements org.w3c.dom.Node.setTextContent.

This attribute returns the text content of this node and its descendants.
public Object
setUserData(String
The key to associate the object to.
key
,
Object
The object to associate to the given key, or null to remove any existing association to that key.
data
,
UserDataHandler
The handler to associate to that key, or null.
handler
)

Implements org.w3c.dom.Node.setUserData.

Associate an object to a key on this node.
public boolean
supports(String feature, String version)

Inherited from org.dom4j.tree.DefaultElement:
addadditionalNamespacesadditionalNamespacesaddNewNodeattributeattributeattributeattributeattributeCountattributeIteratorattributeListattributeListattributesclearContentclonecontentListdeclaredNamespaceselementelementelementgetDocumentgetNamespaceForPrefixgetNamespaceForURIgetParentgetQNamegetStringValuegetTextindexOfnodenodeCountnodeIteratorprocessingInstructionprocessingInstructionsprocessingInstructionsremoveremoveNoderemoveProcessingInstructionsetAttributeListsetAttributessetContentsetDocumentsetParentsetQNamesupportsParent