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.
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public Element | Returns: thisElement instance.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: thisElement instance.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 | |
| public Element | Returns: thisElement instance.is the text for the comment)Comment node.Adds a new |
| public Element | |
| public List | Returns: a list of any additional namespace declarations.Returns any additional namespaces declarations for this element other
than namespace returned via the |
| public Element | Returns: thisElement instance.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: thisElement instance.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: thisElement instance.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 | |
| 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 rangeDOCUMENT ME! index)Returns the attribute at the specified indexGets the |
| public Attribute | |
| public Attribute | |
| public int | |
| public Iterator | |
| public List | Returns: the attributes that this element contains as aListReturns the |
| public String | Returns: the value of the attribute, null if the attribute does not exist or the empty stringis 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.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 stringis 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.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 ElementCreates 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 ElementDOCUMENT 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 ElementDOCUMENT ME! qName)Creates a deep copy of this element with the given fully qualified name. |
| public List | Returns: a list of namespaces declared for this element.Returns all the namespaces declared by this element. |
| public Element | |
| public Element | |
| public Iterator | Returns: an iterator over the contained elementsReturns an iterator over all this elements child elements. |
| public Iterator | Returns: an iterator over the contained elements matching the given local nameDOCUMENT ME! name)Returns an iterator over the elements contained in this element which match the given local name and any namespace. |
| public Iterator | Returns: an iterator over the contained elements matching the given fully qualified nameis 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 | Returns: a list of all the elements in this element.Returns the elements contained in this element. |
| public List | |
| public List | |
| public String | |
| public String | |
| public String | |
| public String | |
| public Object | |
| public Namespace | Returns: theNamespace associated with this elementReturns the |
| public Namespace | Returns: theNamespace associated with the given prefixDOCUMENT ME! prefix)Returns the |
| public Namespace | Returns: theNamespace associated with the given URIDOCUMENT ME! uri)Returns the |
| public String | Returns: the prefix of theNamespace of this element or an
empty StringReturns the namespace prefix of this element if one exists otherwise an
empty |
| public List | Returns: the namespaces associated with the given URIDOCUMENT 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 theNamespace of this element or an
empty StringReturns the URI mapped to the namespace of this element if one exists
otherwise an empty |
| public QName | Returns: theQName associated with this elementReturns the |
| public QName | |
| public String | Returns: the fully qualified name of the element.Returns the fully qualified name of this element. |
| public String | Returns: the text from all the child Text and Element nodes appended together.Redeclares org. |
| public String | Returns: the textual content of this Element. Child elements are not navigated. This method does not return null;Redeclares org. |
| public String | Returns: the trimmed text value where whitespace is trimmed and normalised into single spaces. This method does not return null.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.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.Returns true if this |
| public boolean | Returns: true if this element is the root element of a document and this element supports the parent relationship else false.DOCUMENT ME! |
| public boolean | Returns: true if this element is empty or only contains text content.Returns true if this |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public void | |
| 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
Sets the attribute value of the given local name.
addAttribute(String, String) instead. WILL BE REMOVED IN
dom4j-1.6 !!
|
| 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
Sets the attribute value of the given fully qualified name.
addAttribute(QName, String) instead. WILL BE REMOVED IN
dom4j-1.6 !!
|
| public void | |
| public void |
| add | back to summary |
|---|---|
| public void add(Attribute attribute) Adds the given
| |
| add | back to summary |
|---|---|
| public void add(CDATA cdata) Adds the given
| |
| add | back to summary |
|---|---|
| public void add(Entity entity) Adds the given
| |
| add | back to summary |
|---|---|
| public void add(Text text) Adds the given
| |
| add | back to summary |
|---|---|
| public void add(Namespace namespace) Adds the given
| |
| addAttribute | back 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. | |
| addAttribute | back 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. | |
| addCDATA | back to summary |
|---|---|
| public Element addCDATA(String cdata) Adds a new | |
| addComment | back to summary |
|---|---|
| public Element addComment(String comment) Adds a new | |
| addEntity | back to summary |
|---|---|
| public Element addEntity(String name, String text) Adds a new | |
| additionalNamespaces | back to summary |
|---|---|
| public List Returns any additional namespaces declarations for this element other
than namespace returned via the | |
| addNamespace | back to summary |
|---|---|
| public Element addNamespace(String prefix, String uri) Adds a namespace to this element for use by its child content | |
| addProcessingInstruction | back to summary |
|---|---|
| public Element addProcessingInstruction(String target, String text) Adds a processing instruction for the given target | |
| addProcessingInstruction | back to summary |
|---|---|
| public Element addProcessingInstruction(String target, Map<String, String> data) Adds a processing instruction for the given target | |
| addText | back to summary |
|---|---|
| public Element addText(String text) Adds a new | |
| appendAttributes | back to summary |
|---|---|
| public void appendAttributes(Element element) Appends the attributes of the given element to me. This method behaves
like the
| |
| attribute | back to summary |
|---|---|
| public Attribute attribute(int index) Returns the attribute at the specified indexGets the
| |
| attribute | back to summary |
|---|---|
| public Attribute attribute(String name) Returns the attribute with the given name | |
| attribute | back to summary |
|---|---|
| public Attribute attribute(QName qName) DOCUMENT ME! | |
| attributeCount | back to summary |
|---|---|
| public int attributeCount() DOCUMENT ME!
| |
| attributeIterator | back to summary |
|---|---|
| public Iterator DOCUMENT ME! | |
| attributes | back to summary |
|---|---|
| public List Returns the | |
| attributeValue | back 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. | |
| attributeValue | back 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. | |
| attributeValue | back 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. | |
| attributeValue | back 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. | |
| createCopy | back 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.
| |
| createCopy | back 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. | |
| createCopy | back 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. | |
| declaredNamespaces | back to summary |
|---|---|
| public List 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. | |
| element | back to summary |
|---|---|
| public Element element(String name) Returns the first element for the given local name and any namespace. | |
| element | back to summary |
|---|---|
| public Element element(QName qName) Returns the first element for the given fully qualified name. | |
| elementIterator | back to summary |
|---|---|
| public Iterator Returns an iterator over all this elements child elements. | |
| elementIterator | back to summary |
|---|---|
| public Iterator Returns an iterator over the elements contained in this element which match the given local name and any namespace. | |
| elementIterator | back to summary |
|---|---|
| public Iterator Returns an iterator over the elements contained in this element which match the given fully qualified name. | |
| elements | back to summary |
|---|---|
| public List 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. | |
| elements | back to summary |
|---|---|
| public List 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. | |
| elements | back to summary |
|---|---|
| public List 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. | |
| elementText | back to summary |
|---|---|
| public String elementText(String name) | |
| elementText | back to summary |
|---|---|
| public String elementText(QName qname) | |
| elementTextTrim | back to summary |
|---|---|
| public String elementTextTrim(String name) | |
| elementTextTrim | back to summary |
|---|---|
| public String elementTextTrim(QName qname) | |
| getData | back 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
| |
| getNamespace | back to summary |
|---|---|
| public Namespace getNamespace() Returns the
| |
| getNamespaceForPrefix | back to summary |
|---|---|
| public Namespace getNamespaceForPrefix(String prefix) Returns the | |
| getNamespaceForURI | back to summary |
|---|---|
| public Namespace getNamespaceForURI(String uri) Returns the | |
| getNamespacePrefix | back to summary |
|---|---|
| public String getNamespacePrefix() Returns the namespace prefix of this element if one exists otherwise an
empty
| |
| getNamespacesForURI | back to summary |
|---|---|
| public List Returns the all namespaces which are mapped to the given URI or an empty list if no such namespaces could be found. | |
| getNamespaceURI | back to summary |
|---|---|
| public String getNamespaceURI() Returns the URI mapped to the namespace of this element if one exists
otherwise an empty
| |
| getQName | back to summary |
|---|---|
| public QName getQName() Returns the
| |
| getQName | back to summary |
|---|---|
| public QName getQName(String qualifiedName) Returns the | |
| getQualifiedName | back to summary |
|---|---|
| public String getQualifiedName() Returns the fully qualified name of this element. This will be the same
as the value returned from getNamespacePrefix() + ":" + getName()will be returned.
| |
| getStringValue | back to summary |
|---|---|
| public String getStringValue() Redeclares org. 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
| |
| getText | back to summary |
|---|---|
| public String getText() Redeclares org. Returns the text value of this element without recursing through child
elements. This method iterates through all
| |
| getTextTrim | back to summary |
|---|---|
| public String getTextTrim() DOCUMENT ME!
| |
| getXPathResult | back 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.
| |
| hasMixedContent | back to summary |
|---|---|
| public boolean hasMixedContent() Returns true if this
| |
| isRootElement | back to summary |
|---|---|
| public boolean isRootElement() DOCUMENT ME!
| |
| isTextOnly | back to summary |
|---|---|
| public boolean isTextOnly() Returns true if this
| |
| remove | back to summary |
|---|---|
| public boolean remove(Attribute attribute) Removes the given
| |
| remove | back to summary |
|---|---|
| public boolean remove(CDATA cdata) Removes the given
| |
| remove | back to summary |
|---|---|
| public boolean remove(Entity entity) Removes the given
| |
| remove | back to summary |
|---|---|
| public boolean remove(Namespace namespace) Removes the given
| |
| remove | back to summary |
|---|---|
| public boolean remove(Text text) Removes the given
| |
| setAttributes | back to summary |
|---|---|
| public void setAttributes(List<Attribute> attributes) Sets the attributes that this element contains | |
| setAttributeValue | back to summary |
|---|---|
| public void setAttributeValue(String name, String value)
Deprecated As of version 0.5. Please use Sets the attribute value of the given local name. | |
| setAttributeValue | back to summary |
|---|---|
| public void setAttributeValue(QName qName, String value)
Deprecated As of version 0.5. Please use Sets the attribute value of the given fully qualified name. | |
| setData | back to summary |
|---|---|
| public void setData(Object data) Sets the data value of this element if this element supports data binding
or calls
| |
| setQName | back to summary |
|---|---|
| public void setQName(QName qname) Sets the
| |