Top Description Methods
org.dom4j

public Interface Element

extends Branch
Known Direct Implementers
org.dom4j.tree.AbstractElement
Annotations
@SuppressWarnings:unused
Imports
java.util.Iterator, .List, .Map

Element interface defines an XML element. An element can have declared namespaces, attributes, child nodes and textual content.

Some of this interface is optional. Some implementations may be read-only and not support being modified. Some implementations may not support the parent relationship and methods such as getParentor getDocument.

Author
James Strachan
Version
$Revision: 1.47 $

Method Summary

Modifier and TypeMethod and Description
public void
add(Attribute
is the attribute to be added
attribute
)

Adds the given Attribute to this element.

public void
add(CDATA
is the CDATA to be added
cdata
)

Adds the given CDATA to this element.

public void
add(Entity
is the entity to be added
entity
)

Adds the given Entity to this element.

public void
add(Text
is the text to be added
text
)

Adds the given Text to this element.

public void
add(Namespace
is the namespace to be added
namespace
)

Adds the given Namespace to this element.

public Element

Returns:

this Element instance.
addAttribute
(String
is the name of the attribute whose value is to be added or updated
name
,
String
is the attribute's value
value
)

Adds the attribute value of the given local name.

public Element

Returns:

this Element instance.
addAttribute
(QName
is the fully qualified name of the attribute whose value is to be added or updated
qName
,
String
is the attribute's value
value
)

Adds the attribute value of the given fully qualified name.

public Element

Returns:

this Element instance.
addCDATA
(String
is the text for the CDATA node.
cdata
)

Adds a new CDATA node with the given text to this element.

public Element

Returns:

this Element instance.
addComment
(String
is the text for the Comment node.
comment
)

Adds a new Comment node with the given text to this element.

public Element

Returns:

this Element instance.
addEntity
(String
is the name for the Entity node.
name
,
String
is the text for the Entity node.
text
)

Adds a new Entity node with the given name and text to this element and returns a reference to the new node.

public List<Namespace>

Returns:

a list of any additional namespace declarations.
additionalNamespaces
()

Returns any additional namespaces declarations for this element other than namespace returned via the getNamespace()method.

public Element

Returns:

this Element instance.
addNamespace
(String
is the prefix to use, which should not be null or blank
prefix
,
String
is the namespace URI
uri
)

Adds a namespace to this element for use by its child content

public Element

Returns:

this Element instance.
addProcessingInstruction
(String
is the target of the processing instruction
target
,
String
is the textual data (key/value pairs) of the processing instruction
text
)

Adds a processing instruction for the given target

public Element

Returns:

this Element instance.
addProcessingInstruction
(String
is the target of the processing instruction
target
,
Map<String, String>
is a Map of the key / value pairs of the processing instruction
data
)

Adds a processing instruction for the given target

public Element

Returns:

this Element instance.
addText
(String
is the text for the Text node.
text
)

Adds a new Text node with the given text to this element.

public void
appendAttributes(Element
is the element whose attributes will be added to me.
element
)

Appends the attributes of the given element to me.

public Attribute

Returns:

the attribute at the specified index where index >= 0 and index < number of attributes or throws an IndexOutOfBoundsException if the index is not within the allowable range
attribute
(int
DOCUMENT ME!
index
)

Returns the attribute at the specified indexGets the

public Attribute

Returns:

the attribute for the given local name in any namespace. If there are more than one attributes with the given local name in different namespaces then the first one is returned.
attribute
(String
DOCUMENT ME!
name
)

Returns the attribute with the given name

public Attribute

Returns:

the attribute for the given fully qualified name or null if it could not be found.
attribute
(QName
is the fully qualified name
qName
)

DOCUMENT ME!

public int

Returns:

the number of attributes this element contains
attributeCount
()

DOCUMENT ME!

public Iterator<Attribute>

Returns:

an iterator over the attributes of this element
attributeIterator
()

DOCUMENT ME!

public List<Attribute>

Returns:

the attributes that this element contains as a List
attributes
()

Returns the Attributeinstances this element contains as a backed Listso that the attributes may be modified directly using the Listinterface.

public String

Returns:

the value of the attribute, null if the attribute does not exist or the empty string
attributeValue
(String
is the name of the attribute value to be returned
name
)

This returns the attribute value for the attribute with the given name and any namespace or null if there is no such attribute or the empty string if the attribute value is empty.

public String

Returns:

the value of the attribute or the defaultValue if the attribute has no value defined.
attributeValue
(String
is the name of the attribute value to be returned
name
,
String
is the default value to be returned if the attribute has no value defined.
defaultValue
)

This returns the attribute value for the attribute with the given name and any namespace or the default value if there is no such attribute value.

public String

Returns:

the value of the attribute, null if the attribute does not exist or the empty string
attributeValue
(QName
is the fully qualified name
qName
)

This returns the attribute value for the attribute with the given fully qualified name or null if there is no such attribute or the empty string if the attribute value is empty.

public String

Returns:

the value of the attribute or the defaultValue if the attribute has no value defined.
attributeValue
(QName
is the fully qualified name
qName
,
String
is the default value to be returned if the attribute has no value defined.
defaultValue
)

This returns the attribute value for the attribute with the given fully qualified name or the default value if there is no such attribute value.

public Element

Returns:

a new deep copy Element
createCopy
()

Creates a deep copy of this element The new element is detached from its parent, and getParent() on the clone will return null.

public Element

Returns:

a new deep copy Element
createCopy
(String
DOCUMENT ME!
name
)

Creates a deep copy of this element with the given local name The new element is detached from its parent, and getParent() on the clone will return null.

public Element

Returns:

a new deep copy Element
createCopy
(QName
DOCUMENT ME!
qName
)

Creates a deep copy of this element with the given fully qualified name.

public List<Namespace>

Returns:

a list of namespaces declared for this element.
declaredNamespaces
()

Returns all the namespaces declared by this element.

public Element

Returns:

the first element with the given local name
element
(String
DOCUMENT ME!
name
)

Returns the first element for the given local name and any namespace.

public Element

Returns:

the first element with the given fully qualified name
element
(QName
is the fully qualified name to search for
qName
)

Returns the first element for the given fully qualified name.

public Iterator<Element>

Returns:

an iterator over the contained elements
elementIterator
()

Returns an iterator over all this elements child elements.

public Iterator<Element>

Returns:

an iterator over the contained elements matching the given local name
elementIterator
(String
DOCUMENT ME!
name
)

Returns an iterator over the elements contained in this element which match the given local name and any namespace.

public Iterator<Element>

Returns:

an iterator over the contained elements matching the given fully qualified name
elementIterator
(QName
is the fully qualified name to search for
qName
)

Returns an iterator over the elements contained in this element which match the given fully qualified name.

public List<Element>

Returns:

a list of all the elements in this element.
elements
()

Returns the elements contained in this element.

public List<Element>

Returns:

a list of all the elements in this element for the given local name
elements
(String
DOCUMENT ME!
name
)

Returns the elements contained in this element with the given local name and any namespace.

public List<Element>

Returns:

a list of all the elements in this element for the given fully qualified name.
elements
(QName
is the fully qualified name to search for
qName
)

Returns the elements contained in this element with the given fully qualified name.

public String
public String
public String
public String
public Object

Returns:

DOCUMENT ME!
getData
()

Accesses the data of this element which may implement data typing bindings such as XML Schema or Java Bean bindings or will return the same value as getText

public Namespace

Returns:

the Namespace associated with this element
getNamespace
()

Returns the Namespace of this element if one exists otherwise Namespace.NO_NAMESPACE is returned.

public Namespace

Returns:

the Namespace associated with the given prefix
getNamespaceForPrefix
(String
DOCUMENT ME!
prefix
)

Returns the Namespace which is mapped to the given prefix or null if it could not be found.

public Namespace

Returns:

the Namespace associated with the given URI
getNamespaceForURI
(String
DOCUMENT ME!
uri
)

Returns the Namespace which is mapped to the given URI or null if it could not be found.

public String

Returns:

the prefix of the Namespace of this element or an empty String
getNamespacePrefix
()

Returns the namespace prefix of this element if one exists otherwise an empty String is returned.

public List<Namespace>

Returns:

the namespaces associated with the given URI
getNamespacesForURI
(String
DOCUMENT ME!
uri
)

Returns the all namespaces which are mapped to the given URI or an empty list if no such namespaces could be found.

public String

Returns:

the URI for the Namespace of this element or an empty String
getNamespaceURI
()

Returns the URI mapped to the namespace of this element if one exists otherwise an empty String is returned.

public QName

Returns:

the QName associated with this element
getQName
()

Returns the QName of this element which represents the local name, the qualified name and the Namespace.

public QName

Returns:

the QName for the given qualified name
getQName
(String
DOCUMENT ME!
qualifiedName
)

Returns the QName for the given qualified name, using the namespace URI in scope for the given prefix of the qualified name or the default namespace if the qualified name has no prefix.

public String

Returns:

the fully qualified name of the element.
getQualifiedName
()

Returns the fully qualified name of this element.

public String

Returns:

the text from all the child Text and Element nodes appended together.
getStringValue
()

Redeclares org.dom4j.Node.getStringValue.

Returns the XPath string-value of this node.
public String

Returns:

the textual content of this Element. Child elements are not navigated. This method does not return null;
getText
()

Redeclares org.dom4j.Node.getText.

Returns the text value of this element without recursing through child elements.
public String

Returns:

the trimmed text value where whitespace is trimmed and normalised into single spaces. This method does not return null.
getTextTrim
()

DOCUMENT ME!

public Node

Returns:

the Node for the given index which will support the parent relationship or null if there is not a node at the given index.
getXPathResult
(int
DOCUMENT ME!
index
)

Returns a node at the given index suitable for an XPath result set.

public boolean

Returns:

true if this element contains mixed content.
hasMixedContent
()

Returns true if this Element has mixed content.

public boolean

Returns:

true if this element is the root element of a document and this element supports the parent relationship else false.
isRootElement
()

DOCUMENT ME!

public boolean

Returns:

true if this element is empty or only contains text content.
isTextOnly
()

Returns true if this Element has text only content.

public boolean

Returns:

true if the attribute was removed
remove
(Attribute
is the attribute to be removed
attribute
)

Removes the given Attribute from this element.

public boolean

Returns:

true if the cdata was removed
remove
(CDATA
is the CDATA to be removed
cdata
)

Removes the given CDATA if the node is an immediate child of this element.

public boolean

Returns:

true if the entity was removed
remove
(Entity
is the entity to be removed
entity
)

Removes the given Entity if the node is an immediate child of this element.

public boolean

Returns:

true if the namespace was removed
remove
(Namespace
is the namespace to be removed
namespace
)

Removes the given Namespace if the node is an immediate child of this element.

public boolean

Returns:

true if the text was removed
remove
(Text
is the text to be removed
text
)

Removes the given Text if the node is an immediate child of this element.

public void
setAttributes(List<Attribute>
DOCUMENT ME!
attributes
)

Sets the attributes that this element contains

public void
setAttributeValue(String
is the name of the attribute whose value is to be added or updated
name
,
String
is the attribute's value
value
)

Deprecated As of version 0.5. Please use addAttribute(String, String) instead. WILL BE REMOVED IN dom4j-1.6 !!
Sets the attribute value of the given local name.
public void
setAttributeValue(QName
is the fully qualified name of the attribute whose value is to be added or updated
qName
,
String
is the attribute's value
value
)

Deprecated As of version 0.5. Please use addAttribute(QName, String) instead. WILL BE REMOVED IN dom4j-1.6 !!
Sets the attribute value of the given fully qualified name.
public void
setData(Object
DOCUMENT ME!
data
)

Sets the data value of this element if this element supports data binding or calls setTextif it doesn't

public void
setQName(QName
is the QName to be associated with this element
qname
)

Sets the QName of this element which represents the local name, the qualified name and the Namespace.

Inherited from org.dom4j.Branch:
addaddaddaddaddElementaddElementaddElementappendContentclearContentcontentelementByIDindexOfnodenodeCountnodeIteratornormalizeprocessingInstructionprocessingInstructionsprocessingInstructionsremoveremoveremoveremoveremoveProcessingInstructionsetContentsetProcessingInstructions

Method Detail

addback to summary
public void add(Attribute attribute)

Adds the given Attribute to this element. If the given node already has a parent defined then an IllegalAddException will be thrown. Attributes with null values are silently ignored. If the value of the attribute is null then this method call will remove any attributes with the QName of this attribute.

Parameters
attribute:Attribute

is the attribute to be added

addback to summary
public void add(CDATA cdata)

Adds the given CDATA to this element. If the given node already has a parent defined then an IllegalAddException will be thrown.

Parameters
cdata:CDATA

is the CDATA to be added

addback to summary
public void add(Entity entity)

Adds the given Entity to this element. If the given node already has a parent defined then an IllegalAddException will be thrown.

Parameters
entity:Entity

is the entity to be added

addback to summary
public void add(Text text)

Adds the given Text to this element. If the given node already has a parent defined then an IllegalAddException will be thrown.

Parameters
text:Text

is the text to be added

addback to summary
public void add(Namespace namespace)

Adds the given Namespace to this element. If the given node already has a parent defined then an IllegalAddException will be thrown.

Parameters
namespace:Namespace

is the namespace to be added

addAttributeback to summary
public Element addAttribute(String name, String value)

Adds the attribute value of the given local name. If an attribute already exists for the given name it will be replaced. Attributes with null values are silently ignored. If the value of the attribute is null then this method call will remove any attributes with the given name.

Parameters
name:String

is the name of the attribute whose value is to be added or updated

value:String

is the attribute's value

Returns:Element

this Element instance.

addAttributeback to summary
public Element addAttribute(QName qName, String value)

Adds the attribute value of the given fully qualified name. If an attribute already exists for the given name it will be replaced. Attributes with null values are silently ignored. If the value of the attribute is null then this method call will remove any attributes with the given name.

Parameters
qName:QName

is the fully qualified name of the attribute whose value is to be added or updated

value:String

is the attribute's value

Returns:Element

this Element instance.

addCDATAback to summary
public Element addCDATA(String cdata)

Adds a new CDATA node with the given text to this element.

Parameters
cdata:String

is the text for the CDATA node.

Returns:Element

this Element instance.

addCommentback to summary
public Element addComment(String comment)

Adds a new Comment node with the given text to this element.

Parameters
comment:String

is the text for the Comment node.

Returns:Element

this Element instance.

addEntityback to summary
public Element addEntity(String name, String text)

Adds a new Entity node with the given name and text to this element and returns a reference to the new node.

Parameters
name:String

is the name for the Entity node.

text:String

is the text for the Entity node.

Returns:Element

this Element instance.

additionalNamespacesback to summary
public List<Namespace> additionalNamespaces()

Returns any additional namespaces declarations for this element other than namespace returned via the getNamespace()method. If no additional namespace declarations are present for this element then an empty list will be returned. The list is backed by the element such that changes to the list will be reflected in the element though the reverse is not the case.

Returns:List<Namespace>

a list of any additional namespace declarations.

addNamespaceback to summary
public Element addNamespace(String prefix, String uri)

Adds a namespace to this element for use by its child content

Parameters
prefix:String

is the prefix to use, which should not be null or blank

uri:String

is the namespace URI

Returns:Element

this Element instance.

addProcessingInstructionback to summary
public Element addProcessingInstruction(String target, String text)

Adds a processing instruction for the given target

Parameters
target:String

is the target of the processing instruction

text:String

is the textual data (key/value pairs) of the processing instruction

Returns:Element

this Element instance.

addProcessingInstructionback to summary
public Element addProcessingInstruction(String target, Map<String, String> data)

Adds a processing instruction for the given target

Parameters
target:String

is the target of the processing instruction

data:Map<String, String>

is a Map of the key / value pairs of the processing instruction

Returns:Element

this Element instance.

addTextback to summary
public Element addText(String text)

Adds a new Text node with the given text to this element.

Parameters
text:String

is the text for the Text node.

Returns:Element

this Element instance.

appendAttributesback to summary
public void appendAttributes(Element element)

Appends the attributes of the given element to me. This method behaves like the java.util.Collection#addAll(java.util.Collection) method.

Parameters
element:Element

is the element whose attributes will be added to me.

attributeback to summary
public Attribute attribute(int index)

Returns the attribute at the specified indexGets the

Parameters
index:int

DOCUMENT ME!

Returns:Attribute

the attribute at the specified index where index >= 0 and index < number of attributes or throws an IndexOutOfBoundsException if the index is not within the allowable range

attributeback to summary
public Attribute attribute(String name)

Returns the attribute with the given name

Parameters
name:String

DOCUMENT ME!

Returns:Attribute

the attribute for the given local name in any namespace. If there are more than one attributes with the given local name in different namespaces then the first one is returned.

attributeback to summary
public Attribute attribute(QName qName)

DOCUMENT ME!

Parameters
qName:QName

is the fully qualified name

Returns:Attribute

the attribute for the given fully qualified name or null if it could not be found.

attributeCountback to summary
public int attributeCount()

DOCUMENT ME!

Returns:int

the number of attributes this element contains

attributeIteratorback to summary
public Iterator<Attribute> attributeIterator()

DOCUMENT ME!

Returns:Iterator<Attribute>

an iterator over the attributes of this element

attributesback to summary
public List<Attribute> attributes()

Returns the Attributeinstances this element contains as a backed Listso that the attributes may be modified directly using the Listinterface. The List is backed by the Element so that changes to the list are reflected in the element and vice versa.

Returns:List<Attribute>

the attributes that this element contains as a List

attributeValueback to summary
public String attributeValue(String name)

This returns the attribute value for the attribute with the given name and any namespace or null if there is no such attribute or the empty string if the attribute value is empty.

Parameters
name:String

is the name of the attribute value to be returned

Returns:String

the value of the attribute, null if the attribute does not exist or the empty string

attributeValueback to summary
public String attributeValue(String name, String defaultValue)

This returns the attribute value for the attribute with the given name and any namespace or the default value if there is no such attribute value.

Parameters
name:String

is the name of the attribute value to be returned

defaultValue:String

is the default value to be returned if the attribute has no value defined.

Returns:String

the value of the attribute or the defaultValue if the attribute has no value defined.

attributeValueback to summary
public String attributeValue(QName qName)

This returns the attribute value for the attribute with the given fully qualified name or null if there is no such attribute or the empty string if the attribute value is empty.

Parameters
qName:QName

is the fully qualified name

Returns:String

the value of the attribute, null if the attribute does not exist or the empty string

attributeValueback to summary
public String attributeValue(QName qName, String defaultValue)

This returns the attribute value for the attribute with the given fully qualified name or the default value if there is no such attribute value.

Parameters
qName:QName

is the fully qualified name

defaultValue:String

is the default value to be returned if the attribute has no value defined.

Returns:String

the value of the attribute or the defaultValue if the attribute has no value defined.

createCopyback to summary
public Element createCopy()

Creates a deep copy of this element The new element is detached from its parent, and getParent() on the clone will return null.

Returns:Element

a new deep copy Element

createCopyback to summary
public Element createCopy(String name)

Creates a deep copy of this element with the given local name The new element is detached from its parent, and getParent() on the clone will return null.

Parameters
name:String

DOCUMENT ME!

Returns:Element

a new deep copy Element

createCopyback to summary
public Element createCopy(QName qName)

Creates a deep copy of this element with the given fully qualified name. The new element is detached from its parent, and getParent() on the clone will return null.

Parameters
qName:QName

DOCUMENT ME!

Returns:Element

a new deep copy Element

declaredNamespacesback to summary
public List<Namespace> declaredNamespaces()

Returns all the namespaces declared by this element. If no namespaces are declared for this element then an empty list will be returned. The list is backed by the element such that changes to the list will be reflected in the element though the reverse is not the case.

Returns:List<Namespace>

a list of namespaces declared for this element.

elementback to summary
public Element element(String name)

Returns the first element for the given local name and any namespace.

Parameters
name:String

DOCUMENT ME!

Returns:Element

the first element with the given local name

elementback to summary
public Element element(QName qName)

Returns the first element for the given fully qualified name.

Parameters
qName:QName

is the fully qualified name to search for

Returns:Element

the first element with the given fully qualified name

elementIteratorback to summary
public Iterator<Element> elementIterator()

Returns an iterator over all this elements child elements.

Returns:Iterator<Element>

an iterator over the contained elements

elementIteratorback to summary
public Iterator<Element> elementIterator(String name)

Returns an iterator over the elements contained in this element which match the given local name and any namespace.

Parameters
name:String

DOCUMENT ME!

Returns:Iterator<Element>

an iterator over the contained elements matching the given local name

elementIteratorback to summary
public Iterator<Element> elementIterator(QName qName)

Returns an iterator over the elements contained in this element which match the given fully qualified name.

Parameters
qName:QName

is the fully qualified name to search for

Returns:Iterator<Element>

an iterator over the contained elements matching the given fully qualified name

elementsback to summary
public List<Element> elements()

Returns the elements contained in this element. If this element does not contain any elements then this method returns an empty list. The list is backed by the element such that changes to the list will be reflected in the element though the reverse is not the case.

Returns:List<Element>

a list of all the elements in this element.

elementsback to summary
public List<Element> elements(String name)

Returns the elements contained in this element with the given local name and any namespace. If no elements are found then this method returns an empty list. The list is backed by the element such that changes to the list will be reflected in the element though the reverse is not the case.

Parameters
name:String

DOCUMENT ME!

Returns:List<Element>

a list of all the elements in this element for the given local name

elementsback to summary
public List<Element> elements(QName qName)

Returns the elements contained in this element with the given fully qualified name. If no elements are found then this method returns an empty list. The list is backed by the element such that changes to the list will be reflected in the element though the reverse is not the case.

Parameters
qName:QName

is the fully qualified name to search for

Returns:List<Element>

a list of all the elements in this element for the given fully qualified name.

elementTextback to summary
public String elementText(String name)
elementTextback to summary
public String elementText(QName qname)
elementTextTrimback to summary
public String elementTextTrim(String name)
elementTextTrimback to summary
public String elementTextTrim(QName qname)
getDataback to summary
public Object getData()

Accesses the data of this element which may implement data typing bindings such as XML Schema or Java Bean bindings or will return the same value as getText

Returns:Object

DOCUMENT ME!

getNamespaceback to summary
public Namespace getNamespace()

Returns the Namespace of this element if one exists otherwise Namespace.NO_NAMESPACE is returned.

Returns:Namespace

the Namespace associated with this element

getNamespaceForPrefixback to summary
public Namespace getNamespaceForPrefix(String prefix)

Returns the Namespace which is mapped to the given prefix or null if it could not be found.

Parameters
prefix:String

DOCUMENT ME!

Returns:Namespace

the Namespace associated with the given prefix

getNamespaceForURIback to summary
public Namespace getNamespaceForURI(String uri)

Returns the Namespace which is mapped to the given URI or null if it could not be found. If there is more than one Namespace mapped to the URI, which of them will be returned is undetermined.

Parameters
uri:String

DOCUMENT ME!

Returns:Namespace

the Namespace associated with the given URI

getNamespacePrefixback to summary
public String getNamespacePrefix()

Returns the namespace prefix of this element if one exists otherwise an empty String is returned.

Returns:String

the prefix of the Namespace of this element or an empty String

getNamespacesForURIback to summary
public List<Namespace> getNamespacesForURI(String uri)

Returns the all namespaces which are mapped to the given URI or an empty list if no such namespaces could be found.

Parameters
uri:String

DOCUMENT ME!

Returns:List<Namespace>

the namespaces associated with the given URI

Since
1.5
getNamespaceURIback to summary
public String getNamespaceURI()

Returns the URI mapped to the namespace of this element if one exists otherwise an empty String is returned.

Returns:String

the URI for the Namespace of this element or an empty String

getQNameback to summary
public QName getQName()

Returns the QName of this element which represents the local name, the qualified name and the Namespace.

Returns:QName

the QName associated with this element

getQNameback to summary
public QName getQName(String qualifiedName)

Returns the QName for the given qualified name, using the namespace URI in scope for the given prefix of the qualified name or the default namespace if the qualified name has no prefix.

Parameters
qualifiedName:String

DOCUMENT ME!

Returns:QName

the QName for the given qualified name

getQualifiedNameback to summary
public String getQualifiedName()

Returns the fully qualified name of this element. This will be the same as the value returned from getNameif this element has no namespace attached to this element or an expression of the form

getNamespacePrefix() + ":" + getName()
will be returned.
Returns:String

the fully qualified name of the element.

getStringValueback to summary
public String getStringValue()

Redeclares org.dom4j.Node.getStringValue.

Returns the XPath string-value of this node. The behaviour of this method is defined in the XPath specification . This method returns the string-value of all the contained Text,CDATA,Entityand Element nodes all appended together.

Returns:String

the text from all the child Text and Element nodes appended together.

getTextback to summary
public String getText()

Redeclares org.dom4j.Node.getText.

Returns the text value of this element without recursing through child elements. This method iterates through all Text,CDATA and Entitynodes that this element contains and appends the text values together.

Returns:String

the textual content of this Element. Child elements are not navigated. This method does not return null;

getTextTrimback to summary
public String getTextTrim()

DOCUMENT ME!

Returns:String

the trimmed text value where whitespace is trimmed and normalised into single spaces. This method does not return null.

getXPathResultback to summary
public Node getXPathResult(int index)

Returns a node at the given index suitable for an XPath result set. This means the resulting Node will either be null or it will support the parent relationship.

Parameters
index:int

DOCUMENT ME!

Returns:Node

the Node for the given index which will support the parent relationship or null if there is not a node at the given index.

hasMixedContentback to summary
public boolean hasMixedContent()

Returns true if this Element has mixed content. Mixed content means that an element contains both textual data and child elements.

Returns:boolean

true if this element contains mixed content.

isRootElementback to summary
public boolean isRootElement()

DOCUMENT ME!

Returns:boolean

true if this element is the root element of a document and this element supports the parent relationship else false.

isTextOnlyback to summary
public boolean isTextOnly()

Returns true if this Element has text only content.

Returns:boolean

true if this element is empty or only contains text content.

removeback to summary
public boolean remove(Attribute attribute)

Removes the given Attribute from this element.

Parameters
attribute:Attribute

is the attribute to be removed

Returns:boolean

true if the attribute was removed

removeback to summary
public boolean remove(CDATA cdata)

Removes the given CDATA if the node is an immediate child of this element. If the given node is not an immediate child of this element then the Node#detach()method should be used instead.

Parameters
cdata:CDATA

is the CDATA to be removed

Returns:boolean

true if the cdata was removed

removeback to summary
public boolean remove(Entity entity)

Removes the given Entity if the node is an immediate child of this element. If the given node is not an immediate child of this element then the Node#detach()method should be used instead.

Parameters
entity:Entity

is the entity to be removed

Returns:boolean

true if the entity was removed

removeback to summary
public boolean remove(Namespace namespace)

Removes the given Namespace if the node is an immediate child of this element. If the given node is not an immediate child of this element then the Node#detach()method should be used instead.

Parameters
namespace:Namespace

is the namespace to be removed

Returns:boolean

true if the namespace was removed

removeback to summary
public boolean remove(Text text)

Removes the given Text if the node is an immediate child of this element. If the given node is not an immediate child of this element then the Node#detach()method should be used instead.

Parameters
text:Text

is the text to be removed

Returns:boolean

true if the text was removed

setAttributesback to summary
public void setAttributes(List<Attribute> attributes)

Sets the attributes that this element contains

Parameters
attributes:List<Attribute>

DOCUMENT ME!

setAttributeValueback to summary
public void setAttributeValue(String name, String value)

Deprecated

As of version 0.5. Please use addAttribute(String, String) instead. WILL BE REMOVED IN dom4j-1.6 !!

Sets the attribute value of the given local name.

Parameters
name:String

is the name of the attribute whose value is to be added or updated

value:String

is the attribute's value

setAttributeValueback to summary
public void setAttributeValue(QName qName, String value)

Deprecated

As of version 0.5. Please use addAttribute(QName, String) instead. WILL BE REMOVED IN dom4j-1.6 !!

Sets the attribute value of the given fully qualified name.

Parameters
qName:QName

is the fully qualified name of the attribute whose value is to be added or updated

value:String

is the attribute's value

setDataback to summary
public void setData(Object data)

Sets the data value of this element if this element supports data binding or calls setTextif it doesn't

Parameters
data:Object

DOCUMENT ME!

setQNameback to summary
public void setQName(QName qname)

Sets the QName of this element which represents the local name, the qualified name and the Namespace.

Parameters
qname:QName

is the QName to be associated with this element