See NamespaceAware and getNamespacesInScope() for more
details on what the Namespace scope is and how it is managed in JDOM and
specifically by this Element class.
NamespaceAware, Content
| Modifier and Type | Field and Description |
|---|---|
| pack-priv transient List | additionalNamespaces
Additional namespace declarations to store on this element; useful during output |
| pack-priv transient AttributeList | attributes
The attributes of the element. |
| pack-priv transient ContentList | content
The content of the element. |
| private static final int | |
| protected String | name
The local name of the element |
| protected Namespace | namespace
The namespace of the element |
| private static final long | serialVersionUID
JDOM2 Serialization.
|
| Access | Constructor and Description |
|---|---|
| protected | Element()
This protected constructor is provided in order to support an Element subclass that wants full control over variable initialization. |
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Element | Returns: this element modifiedString to addThis adds text content to this element. |
| public Element | Returns: the element on which the method was calledchild to append to end of content list child)Implements org. |
| public Element | Returns: the element on which the method was calledCollection of content to appendImplements org. |
| public Element | Returns: the parent on which the method was calledlocation for adding the collection index, final Content child to insert child)Implements org. |
| public Element | Returns: the parent on which the method was calledlocation for adding the collection index, final Collection<? extends Content> Collection of content to insertImplements org. |
| public boolean | Returns: true if the namespace is added (false if it was previously added)namespace to add additionalNamespace)Adds a namespace declarations to this element. |
| public void | canContainContent(Content
The content to be checked child, int The location where the content would be put. index, boolean true if the intention is to replace the content already at
the index. replace)Implements org. |
| public Element | Returns: the clone of this elementOverrides org. Implements org. This returns a deep clone of this element. |
| public List | cloneContent()
Implements org. |
| public boolean | Returns: true if any content was changed by this operation.true if you want the text of child elements coalesced too. False
if you only want to coalesce this Element's Text. recursively)Adjacent Text content is merged into the first Text in document order, and the redundant Text items are removed (including any empty Text). |
| public Element | detach()
Overrides org. |
| public List | Returns: a List of the additional namespace declarationsReturns a list of the additional namespace declarations on this element. |
| public Attribute | Returns: attribute for the elementname of the attribute to return attname)This returns the attribute for this element with the given name and within no namespace, or null if no such attribute exists. |
| public Attribute | Returns: attribute for the elementname of the attribute to return attname, final Namespace Namespace to search within. A null implies Namespace.NO_NAMESPACE.This returns the attribute for this element with the given name and within the given Namespace, or null if no such attribute exists. |
| pack-priv AttributeList | Returns: this Element's Attribute List (creating it if necessary).Lazy initialiser for the Attribute list. |
| public List | Returns: attributes for the element
This returns the complete set of attributes for this element, as a
|
| public int | Returns: the number of Attributes attached.Get the number of Attributes currently attached to this Element. |
| public String | Returns: the named attribute's value, or null if no such attributename of the attribute whose value to be returned attname)This returns the attribute value for the attribute with the given name and within no namespace, null if there is no such attribute, and the empty string if the attribute value is empty. |
| public String | Returns: the named attribute's value, or the default if no such attributename of the attribute whose value to be returned attname, final String a default value to return if the attribute does not exist def)This returns the attribute value for the attribute with the given name and within no namespace, or the passed-in default if there is no such attribute. |
| public String | Returns: the named attribute's value, or null if no such attributename of the attribute whose valud is to be returned attname, final Namespace Namespace to search within. A null implies Namespace.NO_NAMESPACE.This returns the attribute value for the attribute with the given name and within the given Namespace, null if there is no such attribute, and the empty string if the attribute value is empty. |
| public String | Returns: the named attribute's value, or the default if no such attributename of the attribute whose valud is to be returned attname, final Namespace Namespace to search within. A null implies Namespace.NO_NAMESPACE.a default value to return if the attribute does not exist def)This returns the attribute value for the attribute with the given name and within the given Namespace, or the passed-in default if there is no such attribute. |
| public Element | Returns: the first matching child element, or null if not foundlocal name of child element to match. A null implies any name cname, final Namespace Namespace to search within. A null implies any namespace.This returns the first child element within this element with the given local name and belonging to the given namespace. |
| public Element | |
| public List | Returns: list of childElement objects for this elementThis returns a |
| public List | Returns: all matching child elementslocal name for the children to match cname)This returns a |
| public List | Returns: all matching child elementslocal name for the children to match cname, final Namespace Namespace to search within. A null implies Namespace.NO_NAMESPACE.This returns a |
| public String | Returns: text content for the named child, or null if no such childthe name of the child cname)Returns the textual content of the named child element, or null if there's no such child. |
| public String | Returns: text content for the named child, or null if no such childthe name of the child cname, final Namespace the namespace of the child. A null implies Namespace.NO_NAMESPACE. ns)Returns the textual content of the named child element, or null if there's no such child. |
| public String | Returns: normalized text content for the named child, or null if no such childthe name of the child cname)Returns the normalized textual content of the named child element, or null if there's no such child. |
| public String | Returns: normalized text content for the named child, or null if no such childthe name of the child cname, final Namespace the namespace of the child. A null implies Namespace.NO_NAMESPACE. ns)Returns the normalized textual content of the named child element, or null if there's no such child. |
| public String | Returns: trimmed text content for the named child, or null if no such childthe name of the child cname)Returns the trimmed textual content of the named child element, or null if there's no such child. |
| public String | Returns: trimmed text content for the named child, or null if no such childthe name of the child cname, final Namespace the namespace of the child. A null implies Namespace.NO_NAMESPACE. ns)Returns the trimmed textual content of the named child element, or null if there's no such child. |
| public List | Returns: aList containing the mixed content of the
element: may contain Text,
, ,
,
, and
objects.Implements org. Text, Element,
Comment, ProcessingInstruction,
CDATA, and EntityRef.
|
| public <E extends Content> List | Returns: List - filtered Element contentFilter to apply
Note that the Filters class has a number of predefined, useful
filters.Implements org. Element's content.
|
| public Content | getContent(final int
location of desired child index)Implements org. |
| public int | getContentSize()
Implements org. |
| public IteratorIterable | Returns: an iterator to walk descendantsImplements org. |
| public <F extends Content> IteratorIterable | Returns: an iterator to walk descendants within a filterfilter to select which descendants to see
Note that the filter)Filters class has a number of predefined, useful
filters.Implements org. |
| public String | Returns: local element nameReturns the (local) name of the element (without any namespace prefix). |
| public Namespace | |
| public Namespace | Returns: the Namespace for this prefix at this location, or null if nonenamespace prefix to look up prefix)Returns the |
| public String | Returns: the namespace prefixReturns the namespace prefix of the element or an empty string if none exists. |
| public List | getNamespacesInherited()
Overrides org. Implements org. |
| public List | getNamespacesInScope()
Overrides org. Implements org. |
| public List | getNamespacesIntroduced()
Overrides org. Implements org. |
| public String | Returns: the namespace URI for this elementReturns the namespace URI mapped to this element's prefix (or the in-scope default namespace URI if no prefix). |
| public String | Returns: qualified name of the element (including namespace prefix)Returns the full name of the element, in the form [namespacePrefix]:[localName]. |
| public String | Returns: text content for this element, or empty string if noneReturns the textual content directly held under this element as a string. |
| public String | Returns: normalized text content for this element, or empty string if noneReturns the textual content of this element with all surrounding whitespace removed and internal whitespace normalized to a single space. |
| public String | Returns: trimmed text content for this element, or empty string if noneReturns the textual content of this element with all surrounding whitespace removed. |
| public String | Returns: a concatenation of all text node descendantsImplements abstract org. |
| public URI | Returns: a URI representing the XMLBase value for the supplied Element, or null if one could not be calculated.Calculate the XMLBase URI for this Element using the rules defined in the XMLBase specification, as well as the values supplied in the xml:base attributes on this Element and its ancestry. |
| public boolean | Returns: true if this Element has additional Namespaces.Indicate whether this Element has any additional Namespace declarations. |
| public boolean | Returns: true if this Element has attributes.Indicate whether this Element has any attributes. |
| public int | indexOf(final Content
child to search for child)Implements org. |
| public boolean | Returns: true if this element is the ancestor of the
supplied elementElement to check againstDetermines if this element is the ancestor of another element. |
| public boolean | Returns: whether this is a root elementReturns whether this element is a root element. |
| private void | readObject(final ObjectInputStream
where to read the Element from. in)Read an Element off the ObjectInputStream. |
| public boolean | Returns: whether the attribute was removedname of attribute to remove attname)This removes the attribute with the given name and within no namespace. |
| public boolean | Returns: whether the attribute was removedname of attribute to remove attname, final Namespace namespace URI of attribute to remove. A null implies Namespace.NO_NAMESPACE. ns)This removes the attribute with the given name and within the given Namespace. |
| public boolean | Returns: whether the attribute was removedReference to the attribute to be removed. attribute)This removes the supplied Attribute should it exist. |
| public boolean | Returns: whether deletion occurredthe name of child elements to remove cname)This removes the first child element (one level deep) with the given local name and belonging to no namespace. |
| public boolean | Returns: whether deletion occurredthe name of child element to remove cname, final Namespace Namespace to search within. A null implies Namespace.NO_NAMESPACE.This removes the first child element (one level deep) with the given local name and belonging to the given namespace. |
| public boolean | Returns: whether deletion occurredthe name of child elements to remove cname)This removes all child elements (one level deep) with the given local name and belonging to no namespace. |
| public boolean | Returns: whether deletion occurredthe name of child elements to remove cname, final Namespace Namespace to search within. A null implies Namespace.NO_NAMESPACE.This removes all child elements (one level deep) with the given local name and belonging to the given namespace. |
| public List | Returns: list of the old children detached from this parentImplements org. |
| public <F extends Content> List | Returns: list of the old children detached from this parentfilter to select which content to remove
Note that the filter)Filters class has a number of predefined, useful
filters.Implements org. |
| public boolean | removeContent(final Content
child to remove child)Implements org. |
| public Content | removeContent(final int
index of child to remove index)Implements org. |
| public void | removeNamespaceDeclaration(final Namespace
namespace to remove. A null Namespace does nothing. additionalNamespace)Removes an additional namespace declarations from this element. |
| private final URI | |
| public Element | Returns: this element modifiedname of the attribute to set name, final String value of the attribute to set value)This sets an attribute value for this element. |
| public Element | Returns: this element modifiedname of the attribute to set name, final String value of the attribute to set value, final Namespace namespace of the attribute to set. A null implies Namespace.NO_NAMESPACE. ns)This sets an attribute value for this element. |
| public Element | Returns: this element modifiedAttribute to setThis sets an attribute value for this element. |
| public Element | Returns: this element modifiedCollection of attributes to setThis sets the attributes of the element. |
| public Element | Returns: this element modifiedCollection of content to setThis sets the content of the element. |
| public Element | Returns: element on which this method was invoked- index of child to replace. index, final Content - child to add. child)Replace the current child the given index with the supplied child. |
| public Parent | Returns: object on which this method was invoked- index of child to replace. index, final Collection<? extends Content> - newContent)Collection of content to replace child.Replace the child at the given index with the supplied collection. |
| public Element | Returns: the parent on which the method was callednew content to replace existing content child)Set this element's content to be the supplied child. |
| public Element | |
| public Element | Returns: the target elementthe new namespace. A null implies Namespace.NO_NAMESPACE. namespace)Sets the element's |
| public Element | |
| public void | sortAttributes(Comparator<? super Attribute>
The Comparator to use for the sorting. comparator)Sort the Attributes of this Element using a mechanism that is safe for JDOM. |
| public void | sortChildren(Comparator<? super Element>
The Comparator to use for the sorting. comparator)Sort the child Elements of this Element using a mechanism that is safe for JDOM content. |
| public void | sortContent(Comparator<? super Content>
The Comparator to use for the sorting. comparator)Sort the contents of this Element using a mechanism that is safe for JDOM content. |
| public < The generic type of the Filter used to select the content to
sort. E extends Content> void | sortContent(Filter<E>
The Filter used to select which child content to sort.
Note that the filter, Comparator<? super E> Filters class has a number of predefined, useful
filters.The Comparator to use for the sorting. comparator)Sort the child content of this Element that matches the Filter, using a mechanism that is safe for JDOM content. |
| public String | Returns: String - information about the
ElementOverrides java.
This returns a |
| private void |