Java org.jdom2 Element fields, constructors, methods, implement or subclass

Example usage for Java org.jdom2 Element fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.jdom2 Element.

The text is from its open source code.

Subclass

org.jdom2.Element has subclasses.
Click this link to see all its subclasses.

Constructor

Element(final String name, final Namespace namespace)
Creates a new element with the supplied (local) name and namespace.
Element(final String name, final String uri)
Creates a new element with the supplied (local) name and a namespace given by a URI.
Element(final String name)
Create a new element with the supplied (local) name and no namespace.
Element(final String name, final String prefix, final String uri)
Creates a new element with the supplied (local) name and a namespace given by the supplied prefix and URI combination.

Method

ElementaddContent(final String str)
This adds text content to this element.
ElementaddContent(final Content child)
Appends the child to the end of the element's content list.
ElementaddContent(final Collection newContent)
Appends all children in the given collection to the end of the content list.
ElementaddContent(final int index, final Content child)
Inserts the child into the content list at the given index.
ElementaddContent(final int index, final Collection newContent)
Inserts the content in a collection into the content list at the given index.
booleanaddNamespaceDeclaration(final Namespace additionalNamespace)
Adds a namespace declarations to this element.
Elementclone()

This returns a deep clone of this element.

ListcloneContent()
Elementdetach()
booleanequals(Object ob)
This tests for equality of this Content object to the supplied object.
ListgetAdditionalNamespaces()
Returns a list of the additional namespace declarations on this element.
AttributegetAttribute(final String attname)

This returns the attribute for this element with the given name and within no namespace, or null if no such attribute exists.

AttributegetAttribute(final String attname, final Namespace ns)

This returns the attribute for this element with the given name and within the given Namespace, or null if no such attribute exists.

ListgetAttributes()

This returns the complete set of attributes for this element, as a List of Attribute objects in no particular order, or an empty list if there are none.

StringgetAttributeValue(final String 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.

StringgetAttributeValue(final String attname, final String 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.

StringgetAttributeValue(final String attname, final Namespace ns)

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.

ElementgetChild(final String cname)
This returns the first child element within this element with the given local name and belonging to no namespace.
ElementgetChild(final String cname, final Namespace ns)
This returns the first child element within this element with the given local name and belonging to the given namespace.
ListgetChildren()
This returns a List of all the child elements nested directly (one level deep) within this element, as Element objects.
ListgetChildren(final String cname)
This returns a List of all the child elements nested directly (one level deep) within this element with the given local name and belonging to no namespace, returned as Element objects.
ListgetChildren(final String cname, final Namespace ns)
This returns a List of all the child elements nested directly (one level deep) within this element with the given local name and belonging to the given Namespace, returned as Element objects.
StringgetChildText(final String cname)
Returns the textual content of the named child element, or null if there's no such child.
StringgetChildText(final String cname, final Namespace ns)
Returns the textual content of the named child element, or null if there's no such child.
StringgetChildTextNormalize(final String cname)
Returns the normalized textual content of the named child element, or null if there's no such child.
StringgetChildTextNormalize(final String cname, final Namespace ns)
Returns the normalized textual content of the named child element, or null if there's no such child.
StringgetChildTextTrim(final String cname)
Returns the trimmed textual content of the named child element, or null if there's no such child.
StringgetChildTextTrim(final String cname, final Namespace ns)
Returns the trimmed textual content of the named child element, or null if there's no such child.
ListgetContent(final Filter filter)
Return a filter view of this Element's content.
ContentgetContent(final int index)
ListgetContent()
This returns the full content of the element as a List which may contain objects of type Text, Element, Comment, ProcessingInstruction, CDATA, and EntityRef.
intgetContentSize()
IteratorIterablegetDescendants(final Filter filter)
Returns an iterator that walks over all descendants in document order applying the Filter to return only content that match the filter rule.
IteratorIterablegetDescendants()
Returns an iterator that walks over all descendants in document order.
DocumentgetDocument()
Return this child's owning document or null if the branch containing this child is currently not attached to a document.
StringgetName()
Returns the (local) name of the element (without any namespace prefix).
NamespacegetNamespace()
Returns the element's Namespace .
NamespacegetNamespace(final String prefix)
Returns the Namespace corresponding to the given prefix in scope for this element.
StringgetNamespacePrefix()
Returns the namespace prefix of the element or an empty string if none exists.
ListgetNamespacesInherited()
ListgetNamespacesInScope()
Get the Namespaces that are in-scope on this Element.
ListgetNamespacesIntroduced()
StringgetNamespaceURI()
Returns the namespace URI mapped to this element's prefix (or the in-scope default namespace URI if no prefix).
ParentgetParent()
Return this child's parent, or null if this child is currently not attached.
ElementgetParentElement()
A convenience method that returns any parent element for this element, or null if the element is unattached or is a root element.
StringgetQualifiedName()
Returns the full name of the element, in the form [namespacePrefix]:[localName].
StringgetText()
Returns the textual content directly held under this element as a string.
StringgetTextNormalize()
Returns the textual content of this element with all surrounding whitespace removed and internal whitespace normalized to a single space.
StringgetTextTrim()
Returns the textual content of this element with all surrounding whitespace removed.
StringgetValue()
Returns the XPath 1.0 string value of this element, which is the complete, ordered content of all text node descendants of this element (i.e. the text that's left after all references are resolved and all other markup is stripped out.)
booleanhasAttributes()
Indicate whether this Element has any attributes.
inthashCode()
This returns the hash code for this Content item.
intindexOf(final Content child)
booleanisAncestor(final Element element)
Determines if this element is the ancestor of another element.
booleanisRootElement()
Returns whether this element is a root element.
booleanremoveAttribute(final String attname)

This removes the attribute with the given name and within no namespace.

booleanremoveAttribute(final Attribute attribute)

This removes the supplied Attribute should it exist.

booleanremoveAttribute(final String attname, final Namespace ns)

This removes the attribute with the given name and within the given Namespace.

booleanremoveChild(final String cname, final Namespace ns)

This removes the first child element (one level deep) with the given local name and belonging to the given namespace.

booleanremoveChild(final String cname)

This removes the first child element (one level deep) with the given local name and belonging to no namespace.

booleanremoveChildren(final String cname)

This removes all child elements (one level deep) with the given local name and belonging to no namespace.

booleanremoveChildren(final String cname, final Namespace ns)

This removes all child elements (one level deep) with the given local name and belonging to the given namespace.

ListremoveContent(final Filter filter)
Remove all child content from this parent matching the supplied filter.
booleanremoveContent(final Content child)
ContentremoveContent(final int index)
ListremoveContent()
Removes all child content from this parent.
voidremoveNamespaceDeclaration(final Namespace additionalNamespace)
Removes an additional namespace declarations from this element.
ElementsetAttribute(final String name, final String value)

This sets an attribute value for this element.

ElementsetAttribute(final Attribute attribute)

This sets an attribute value for this element.

ElementsetAttribute(final String name, final String value, final Namespace ns)

This sets an attribute value for this element.

ElementsetAttributes(final Collection newAttributes)

This sets the attributes of the element.

ElementsetContent(final Collection newContent)
This sets the content of the element.
ElementsetContent(final Content child)
Set this element's content to be the supplied child.
ElementsetContent(final int index, final Content child)
Replace the current child the given index with the supplied child.
ParentsetContent(final int index, final Collection newContent)
Replace the child at the given index whith the supplied collection.
ElementsetName(final String name)
Sets the (local) name of the element.
ElementsetNamespace(Namespace namespace)
Sets the element's Namespace .
ElementsetText(final String text)
Sets the content of the element to be the text given.
voidsortChildren(Comparator comparator)
Sort the child Elements of this Element using a mechanism that is safe for JDOM content.
StringtoString()

This returns a String representation of the Element, suitable for debugging.