Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jdom
Interface Parent  view Parent download Parent.java

All Superinterfaces:
java.lang.Cloneable, java.io.Serializable
All Known Implementing Classes:
Document, Element

public interface Parent
extends java.lang.Cloneable, java.io.Serializable

Superclass for JDOM objects which are allowed to contain Content content.

Version:
$Revision: 1.12 $, $Date: 2004/08/31 21:47:51 $

Method Summary
 java.lang.Object clone()
          Obtain a deep, unattached copy of this parent and it's children.
 java.util.List cloneContent()
          Returns a list containing detached clones of this parent's content list.
 java.util.List getContent()
          Returns the full content of this parent as a java.util.List which contains objects of type Content.
 java.util.List getContent(org.jdom.filter.Filter filter)
          Returns as a java.util.List the content of this parent that matches the supplied filter.
 Content getContent(int index)
          Returns the child at the given index.
 int getContentSize()
          Returns the number of children in this parent's content list.
 java.util.Iterator getDescendants()
          Returns an java.util.Iterator that walks over all descendants in document order.
 java.util.Iterator getDescendants(org.jdom.filter.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.
 java.util.List removeContent()
          Removes all content from this parent and returns the detached children.
 boolean removeContent(Content child)
          Removes a single child node from the content list.
 java.util.List removeContent(org.jdom.filter.Filter filter)
          Removes from this parent all child content matching the given filter and returns a list of 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.
 

Method Detail

getContentSize

public int getContentSize()
Returns the number of children in this parent's content list. Children may be any Content type.


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.


cloneContent

public java.util.List cloneContent()
Returns a list containing detached clones of this parent's content list.


getContent

public Content getContent(int index)
Returns the child at the given index.


getContent

public java.util.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 List.size()>List.size() 55 may require walking the entire list and indexed lookups may require starting at the beginning each time.


getContent

public java.util.List getContent(org.jdom.filter.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 List.size()>List.size() 55 may require walking the entire list and indexed lookups may require starting at the beginning each time.


removeContent

public java.util.List removeContent()
Removes all content from this parent and returns the detached children.


removeContent

public java.util.List removeContent(org.jdom.filter.Filter filter)
Removes from this parent all child content matching the given filter and returns a list of the detached children.


removeContent

public boolean removeContent(Content child)
Removes a single child node from the content list.


removeContent

public Content removeContent(int index)
Removes and returns the child at the given index, or returns null if there's no such child.


clone

public java.lang.Object clone()
Obtain a deep, unattached copy of this parent and it's children.


getDescendants

public java.util.Iterator getDescendants()
Returns an java.util.Iterator that walks over all descendants in document order.


getDescendants

public java.util.Iterator getDescendants(org.jdom.filter.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.


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.


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.