Example usage for Java org.jdom2 Element fields, constructors, methods, implement or subclass
The text is from its open source code.
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. |
Element | addContent(final String str) This adds text content to this element. |
Element | addContent(final Content child) Appends the child to the end of the element's content list. |
Element | addContent(final Collection extends Content> newContent) Appends all children in the given collection to the end of the content list. |
Element | addContent(final int index, final Content child) Inserts the child into the content list at the given index. |
Element | addContent(final int index, final Collection extends Content> newContent) Inserts the content in a collection into the content list at the given index. |
boolean | addNamespaceDeclaration(final Namespace additionalNamespace) Adds a namespace declarations to this element. |
Element | clone() This returns a deep clone of this element. |
List | cloneContent() |
Element | detach() |
boolean | equals(Object ob) This tests for equality of this Content object to the supplied object. |
List | getAdditionalNamespaces() Returns a list of the additional namespace declarations on this element. |
Attribute | getAttribute(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. |
Attribute | getAttribute(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. |
List | getAttributes() This returns the complete set of attributes for this element, as a |
String | getAttributeValue(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. |
String | getAttributeValue(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. |
String | getAttributeValue(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. |
Element | getChild(final String cname) This returns the first child element within this element with the given local name and belonging to no namespace. |
Element | getChild(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. |
List | getChildren() This returns a List of all the child elements nested directly (one level deep) within this element, as Element objects. |
List | getChildren(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. |
List | getChildren(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. |
String | getChildText(final String cname) Returns the textual content of the named child element, or null if there's no such child. |
String | getChildText(final String cname, final Namespace ns) Returns the textual content of the named child element, or null if there's no such child. |
String | getChildTextNormalize(final String cname) Returns the normalized textual content of the named child element, or null if there's no such child. |
String | getChildTextNormalize(final String cname, final Namespace ns) Returns the normalized textual content of the named child element, or null if there's no such child. |
String | getChildTextTrim(final String cname) Returns the trimmed textual content of the named child element, or null if there's no such child. |
String | getChildTextTrim(final String cname, final Namespace ns) Returns the trimmed textual content of the named child element, or null if there's no such child. |
List | getContent(final Filter Return a filter view of this Element 's content. |
Content | getContent(final int index) |
List | getContent() This returns the full content of the element as a List which may contain objects of type Text , Element , Comment , ProcessingInstruction , CDATA , and EntityRef . |
int | getContentSize() |
IteratorIterable | getDescendants(final Filter Returns an iterator that walks over all descendants in document order applying the Filter to return only content that match the filter rule. |
IteratorIterable | getDescendants() Returns an iterator that walks over all descendants in document order. |
Document | getDocument() Return this child's owning document or null if the branch containing this child is currently not attached to a document. |
String | getName() Returns the (local) name of the element (without any namespace prefix). |
Namespace | getNamespace() Returns the element's Namespace . |
Namespace | getNamespace(final String prefix) Returns the Namespace corresponding to the given prefix in scope for this element. |
String | getNamespacePrefix() Returns the namespace prefix of the element or an empty string if none exists. |
List | getNamespacesInherited() |
List | getNamespacesInScope() Get the Namespaces that are in-scope on this Element. |
List | getNamespacesIntroduced() |
String | getNamespaceURI() Returns the namespace URI mapped to this element's prefix (or the in-scope default namespace URI if no prefix). |
Parent | getParent() Return this child's parent, or null if this child is currently not attached. |
Element | getParentElement() A convenience method that returns any parent element for this element, or null if the element is unattached or is a root element. |
String | getQualifiedName() Returns the full name of the element, in the form [namespacePrefix]:[localName]. |
String | getText() Returns the textual content directly held under this element as a string. |
String | getTextNormalize() Returns the textual content of this element with all surrounding whitespace removed and internal whitespace normalized to a single space. |
String | getTextTrim() Returns the textual content of this element with all surrounding whitespace removed. |
String | getValue() 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.) |
boolean | hasAttributes() Indicate whether this Element has any attributes. |
int | hashCode() This returns the hash code for this Content item. |
int | indexOf(final Content child) |
boolean | isAncestor(final Element element) Determines if this element is the ancestor of another element. |
boolean | isRootElement() Returns whether this element is a root element. |
boolean | removeAttribute(final String attname) This removes the attribute with the given name and within no namespace. |
boolean | removeAttribute(final Attribute attribute) This removes the supplied Attribute should it exist. |
boolean | removeAttribute(final String attname, final Namespace ns) This removes the attribute with the given name and within the given Namespace. |
boolean | removeChild(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. |
boolean | removeChild(final String cname) This removes the first child element (one level deep) with the given local name and belonging to no namespace. |
boolean | removeChildren(final String cname) This removes all child elements (one level deep) with the given local name and belonging to no namespace. |
boolean | removeChildren(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. |
List | removeContent(final Filter Remove all child content from this parent matching the supplied filter. |
boolean | removeContent(final Content child) |
Content | removeContent(final int index) |
List | removeContent() Removes all child content from this parent. |
void | removeNamespaceDeclaration(final Namespace additionalNamespace) Removes an additional namespace declarations from this element. |
Element | setAttribute(final String name, final String value) This sets an attribute value for this element. |
Element | setAttribute(final Attribute attribute) This sets an attribute value for this element. |
Element | setAttribute(final String name, final String value, final Namespace ns) This sets an attribute value for this element. |
Element | setAttributes(final Collection extends Attribute> newAttributes) This sets the attributes of the element. |
Element | setContent(final Collection extends Content> newContent) This sets the content of the element. |
Element | setContent(final Content child) Set this element's content to be the supplied child. |
Element | setContent(final int index, final Content child) Replace the current child the given index with the supplied child. |
Parent | setContent(final int index, final Collection extends Content> newContent) Replace the child at the given index whith the supplied collection. |
Element | setName(final String name) Sets the (local) name of the element. |
Element | setNamespace(Namespace namespace) Sets the element's Namespace . |
Element | setText(final String text) Sets the content of the element to be the text given. |
void | sortChildren(Comparator super Element> comparator) Sort the child Elements of this Element using a mechanism that is safe for JDOM content. |
String | toString() This returns a |