org.jdom
Interface Parent
- Cloneable, Serializable
- Document, Element
public interface Parent
extends Cloneable, Serializable
Superclass for JDOM objects which are allowed to contain
Content
content.
$Revision: 1.12 $, $Date: 2004/08/31 21:47:51 $- Bradley S. Huffman
- Jason Hunter
Object | clone() - Obtain a deep, unattached copy of this parent and it's children.
|
List | cloneContent() - Returns a list containing detached clones of this parent's content list.
|
List | getContent() - Returns the full content of this parent as a
java.util.List
which contains objects of type Content .
|
Content | getContent(int index) - Returns the child at the given index.
|
List | getContent(Filter filter) - Returns as a
java.util.List the content of
this parent that matches the supplied filter.
|
int | getContentSize() - Returns the number of children in this parent's content list.
|
Iterator | getDescendants() - Returns an
java.util.Iterator that walks over all descendants
in document order.
|
Iterator | getDescendants(Filter filter) - Returns an
java.util.Iterator that walks over all descendants
in document order applying the Filter to return only elements that
match the filter rule.
|
Document | getDocument() - Return this parent's owning document or null if the branch containing
this parent is currently not attached to a document.
|
Parent | getParent() - Return this parent's parent, or null if this parent is currently
not attached to another parent.
|
int | indexOf(Content child) - Returns the index of the supplied child in the content list,
or -1 if not a child of this parent.
|
List | removeContent() - Removes all content from this parent and returns the detached
children.
|
Content | removeContent(int index) - Removes and returns the child at the given
index, or returns null if there's no such child.
|
boolean | removeContent(Content child) - Removes a single child node from the content list.
|
List | removeContent(Filter filter) - Removes from this parent all child content matching the given filter
and returns a list of the detached children.
|
clone
public Object clone()
Obtain a deep, unattached copy of this parent and it's children.
- a deep copy of this parent and it's children.
cloneContent
public List cloneContent()
Returns a list containing detached clones of this parent's content list.
- list of cloned child content
getContent
public List getContent()
Returns the full content of this parent as a
java.util.List
which contains objects of type
Content
. The returned list is
"live" and in document order. Any modifications
to it affect the element's actual contents. Modifications are checked
for conformance to XML 1.0 rules.
Sequential traversal through the List is best done with an Iterator
since the underlying implement of
java.util.List.size
may
require walking the entire list and indexed lookups may require
starting at the beginning each time.
- a list of the content of the parent
getContent
public Content getContent(int index)
Returns the child at the given index.
index
- location of desired child
getContent
public List getContent(Filter filter)
Returns as a
java.util.List
the content of
this parent that matches the supplied filter. The returned list is
"live" and in document order. Any modifications to it affect
the element's actual contents. Modifications are checked for
conformance to XML 1.0 rules.
Sequential traversal through the List is best done with an Iterator
since the underlying implement of
java.util.List.size
may
require walking the entire list and indexed lookups may require
starting at the beginning each time.
- a list of the content of the parent matching the filter
getContentSize
public int getContentSize()
Returns the number of children in this parent's content list.
Children may be any
Content
type.
getDescendants
public Iterator getDescendants()
Returns an java.util.Iterator
that walks over all descendants
in document order.
- an iterator to walk descendants
getDescendants
public Iterator getDescendants(Filter filter)
Returns an java.util.Iterator
that walks over all descendants
in document order applying the Filter to return only elements that
match the filter rule. With filters you can match only Elements,
only Comments, Elements or Comments, only Elements with a given name
and/or prefix, and so on.
filter
- filter to select which descendants to see
- an iterator to walk descendants that match a filter
getDocument
public Document getDocument()
Return this parent's owning document or null if the branch containing
this parent is currently not attached to a document.
- this child's owning document or null if none
getParent
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.
- this parent's parent or null if none
indexOf
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.
child
- child to search for
- index of child, or -1 if not found
removeContent
public List removeContent()
Removes all content from this parent and returns the detached
children.
- list of the old content detached from this parent
removeContent
public Content removeContent(int index)
Removes and returns the child at the given
index, or returns null if there's no such child.
index
- index of child to remove
- detached child at given index or null if no
removeContent
public boolean removeContent(Content child)
Removes a single child node from the content list.
- whether the removal occurred
removeContent
public List removeContent(Filter filter)
Removes from this parent all child content matching the given filter
and returns a list of the detached children.
- list of the detached children matching the filter
Copyright B) 2004 Jason Hunter, Brett McLaughlin. All Rights Reserved.