org.jdom2.Content , org.jdom2.Document , org.jdom2.Element
| Modifier and Type | Method and Description |
|---|---|
| public Parent | Returns: the Parent instance on which the method was calledchild to append to end of content list child)Appends the child to the end of the content list. |
| public Parent | Returns: the document on which the method was calledcollection to append c)Appends all children in the given collection to the end of the content list. |
| public Parent | Returns: the parent on which the method was calledlocation for adding the collection index, Content child to insert child)Inserts the child into the content list at the given index. |
| public Parent | Returns: the parent on which the method was calledlocation for adding the collection index, Collection<? extends Content> collection to insert c)Inserts the content in a collection into the content list at the given index. |
| public void | canContainContent(Content
The content to be checked content, 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)Test whether this Parent instance can contain the specified content at the specified position. |
| public Object | Returns: a deep copy of this parent and its children.Obtain a deep, unattached copy of this parent and its children. |
| public List | Returns: list of cloned child contentReturns a list containing detached clones of this parent's content list. |
| public Content | Returns: child at the given indexlocation of desired child index)Returns the child at the given index. |
| public List | Returns: a list of the content of the parentReturns the full content of this parent as a |
| public < The Generic type of the returned content (the Filter's type) E extends Content> List | Returns: a list of the content of the parent matching the filterfilter to apply.
Note that the filter)Filters class has a number of predefined, useful
filters.Returns as a |
| public int | Returns: number of childrenReturns the number of children in this parent's content list. |
| public IteratorIterable | Returns: an iterator to walk descendantsReturns an |
| public < The generic type of the returned descendant data E extends Content> IteratorIterable | Returns: an iterator to walk descendants that match a filterfilter to select which descendants to see
Note that the filter)Filters class has a number of predefined, useful
filters.Returns an |
| public Document | Returns: this child's owning document or null if noneReturn this parent's owning document or null if the branch containing this parent is currently not attached to a document. |
| public Parent | Returns: this parent's parent or null if noneReturn this parent's parent, or null if this parent is currently not attached to another parent. |
| public int | |
| public List | Returns: list of the old content detached from this parentRemoves all content from this parent and returns the detached children. |
| public < The Generic type of the content to remove. E extends Content> List | Returns: list of the detached children matching the filterfilter to apply
Note that the filter)Filters class has a number of predefined, useful
filters.Removes from this parent all child content matching the given filter and returns a list of the detached children. |
| public boolean | Returns: whether the removal occurredchild to remove child)Removes a single child node from the content list. |
| public Content | Returns: detached child at given index or null if noindex of child to remove index)Removes and returns the child at the given index, or returns null if there's no such child. |
| addContent | back to summary |
|---|---|
| public Parent addContent(Content child) Appends the child to the end of the content list.
| |
| addContent | back to summary |
|---|---|
| public Parent addContent(Collection<? extends Content> c) Appends all children in the given collection to the end of the content list. In event of an exception during add the original content will be unchanged and the objects in the supplied collection will be unaltered.
| |
| addContent | back to summary |
|---|---|
| public Parent addContent(int index, Content child) Inserts the child into the content list at the given index.
| |
| addContent | back to summary |
|---|---|
| public Parent addContent(int index, Collection<? extends Content> c) Inserts the content in a collection into the content list at the given index. In event of an exception the original content will be unchanged and the objects in the supplied collection will be unaltered.
| |
| canContainContent | back to summary |
|---|---|
| public void canContainContent(Content content, int index, boolean replace) throws IllegalAddException Test whether this Parent instance can contain the specified content at the specified position.
| |
| clone | back to summary |
|---|---|
| public Object clone() Obtain a deep, unattached copy of this parent and its children.
| |
| cloneContent | back to summary |
|---|---|
| public List Returns a list containing detached clones of this parent's content list. | |
| getContent | back to summary |
|---|---|
| public Content getContent(int index) Returns the child at the given index.
| |
| getContent | back to summary |
|---|---|
| public List Returns the full content of this parent as a
Sequential traversal through the List is best done with an Iterator
since the underlying implement of
| |
| getContent | back to summary |
|---|---|
| public <E extends Content> List Returns as a
Sequential traversal through the List is best done with an Iterator
since the underlying implement of
| |
| getContentSize | back to summary |
|---|---|
| public int getContentSize() Returns the number of children in this parent's content list.
Children may be any
| |
| getDescendants | back to summary |
|---|---|
| public IteratorIterable Returns an Note that this method returns an IteratorIterable instance, which means that you can use it either as an Iterator, or an Iterable, allowing both:
for (Iteratorand
for (Content c : parent.getDescendants()) {
....
}
The Iterator version is most useful if you need to do list modification
on the iterator (using remove()), and for compatibility with JDOM 1.x
| |
| getDescendants | back to summary |
|---|---|
| public <E extends Content> IteratorIterable Returns an Note that this method returns an IteratorIterable instance, which means that you can use it either as an Iterator, or an Iterable, allowing both:
for (Iteratorand
for (Element e : parent.getDescendants(Filters.element())) {
....
}
The Iterator version is most useful if you need to do list modification
on the iterator (using remove()), and for compatibility with JDOM 1.x
| |
| getDocument | back to summary |
|---|---|
| public Document getDocument() Return this parent's owning document or null if the branch containing this parent is currently not attached to a document.
| |
| getParent | back to summary |
|---|---|
| public Parent getParent() Return this parent's parent, or null if this parent is currently not attached to another parent. This is the same method as in Content but also added to Parent to allow more easy up-the-tree walking.
| |
| indexOf | back to summary |
|---|---|
| public int indexOf(Content child) Returns the index of the supplied child in the content list, or -1 if not a child of this parent.
| |
| removeContent | back to summary |
|---|---|
| public List Removes all content from this parent and returns the detached children. | |
| removeContent | back to summary |
|---|---|
| public <E extends Content> List Removes from this parent all child content matching the given filter and returns a list of the detached children. | |
| removeContent | back to summary |
|---|---|
| public boolean removeContent(Content child) Removes a single child node from the content list.
| |
| removeContent | back to summary |
|---|---|
| public Content removeContent(int index) Removes and returns the child at the given index, or returns null if there's no such child.
| |