| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
 Branch interface defines the common behaviour for Nodes which
 can contain child nodes (content) such as XML elements and documents. This
 interface allows both elements and documents to be treated in a polymorphic
 manner when changing or navigating child nodes (content).
 
| Field Summary | 
| Fields inherited from interface org.dom4j.Node | 
| ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE | 
| Method Summary | |
|  void | add(Comment comment)Adds the given Commentto this branch. | 
|  void | add(Element element)Adds the given Elementto this branch. | 
|  void | add(Node node)Adds the given Nodeor throwsIllegalAddExceptionif the given node is not of a valid type. | 
|  void | add(ProcessingInstruction pi)Adds the given ProcessingInstructionto this branch. | 
|  Element | addElement(QName qname)Adds a new Elementnode with the givenQNameto
 this branch and returns a reference to the new node. | 
|  Element | addElement(String name)Adds a new Elementnode with the given name to this branch
 and returns a reference to the new node. | 
|  Element | addElement(String qualifiedName,
           String namespaceURI)Adds a new Elementnode with the given qualified name and
 namespace URI to this branch and returns a reference to the new node. | 
|  void | appendContent(Branch branch)Appends the content of the given branch to this branch instance. | 
|  void | clearContent()Clears the content for this branch, removing any Nodeinstances this branch may contain. | 
|  List | content()Returns the content nodes of this branch as a backed Listso that
 the content of this branch may be modified directly using theListinterface. | 
|  Element | elementByID(String elementID)Returns the element of the given ID attribute value. | 
|  int | indexOf(Node node)Returns the index of the given node if it is a child node of this branch or -1 if the given node is not a child node. | 
|  Node | node(int index)Returns the Nodeat the specified index position. | 
|  int | nodeCount()Returns the number of Nodeinstances that this branch
 contains. | 
|  Iterator | nodeIterator()Returns an iterator through the content nodes of this branch | 
|  void | normalize()Puts all Textnodes in the full depth of the sub-tree
 underneath thisNode, including attribute nodes, into a
 "normal" form where only structure (e.g., elements, comments, processing
 instructions, CDATA sections, and entity references) separatesTextnodes, i.e., there are neither adjacentTextnodes nor emptyTextnodes. | 
|  ProcessingInstruction | processingInstruction(String target)DOCUMENT ME! | 
|  List | processingInstructions()Returns a list of all the processing instructions in this branch. | 
|  List | processingInstructions(String target)Returns a list of the processing instructions for the given target. | 
|  boolean | remove(Comment comment)Removes the given Commentif the node is an immediate
 child of this branch. | 
|  boolean | remove(Element element)Removes the given Elementif the node is an immediate
 child of this branch. | 
|  boolean | remove(Node node)Removes the given Nodeif the node is an immediate child
 of this branch. | 
|  boolean | remove(ProcessingInstruction pi)Removes the given ProcessingInstructionif the node is an
 immediate child of this branch. | 
|  boolean | removeProcessingInstruction(String target)Removes the processing instruction for the given target if it exists | 
|  void | setContent(List content)Sets the contents of this branch as a ListofNodeinstances. | 
|  void | setProcessingInstructions(List listOfPIs)Sets all the processing instructions for this branch | 
| Methods inherited from interface org.dom4j.Node | 
| accept, asXML, asXPathResult, clone, createXPath, detach, getDocument, getName, getNodeType, getNodeTypeName, getParent, getPath, getPath, getStringValue, getText, getUniquePath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, setText, supportsParent, valueOf, write | 
| Method Detail | 
public Node node(int index)
          throws IndexOutOfBoundsException
Node at the specified index position.
index - the index of the node to return.
Node at the specified position.
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >=
             nodeCount()).public int indexOf(Node node)
node - the content child node to find.
public int nodeCount()
Node instances that this branch
 contains.
public Element elementByID(String elementID)
elementID - DOCUMENT ME!
public List content()
 Returns the content nodes of this branch as a backed Listso that
 the content of this branch may be modified directly using the
 Listinterface. The List is backed by the
 Branch so that changes to the list are reflected in the
 branch and vice versa.
 
Listpublic Iterator nodeIterator()
public void setContent(List content)
List of
 Node instances.
content - is the list of nodes to use as the content for this branch.public void appendContent(Branch branch)
Collection.addAll(java.util.Collection) method.
branch - is the branch whose content will be added to me.public void clearContent()
Node
 instances this branch may contain.
public List processingInstructions()
Returns a list of all the processing instructions in this branch. The list is backed by this branch so that changes to the list will be reflected in the branch but the reverse is not the case.
public List processingInstructions(String target)
Returns a list of the processing instructions for the given target. The list is backed by this branch so that changes to the list will be reflected in the branch but the reverse is not the case.
target - DOCUMENT ME!
public ProcessingInstruction processingInstruction(String target)
target - DOCUMENT ME!
public void setProcessingInstructions(List listOfPIs)
listOfPIs - DOCUMENT ME!public Element addElement(String name)
Element node with the given name to this branch
 and returns a reference to the new node.
name - is the name for the Element node.
Element node.public Element addElement(QName qname)
Element node with the given QNameto
 this branch and returns a reference to the new node.
qname - is the qualified name for the Element node.
Element node.
public Element addElement(String qualifiedName,
                          String namespaceURI)
Element node with the given qualified name and
 namespace URI to this branch and returns a reference to the new node.
qualifiedName - is the fully qualified name of the ElementnamespaceURI - is the URI of the namespace to use
Element node.public boolean removeProcessingInstruction(String target)
target - DOCUMENT ME!
public void add(Node node)
Node or throws IllegalAddException
 if the given node is not of a valid type. This is a polymorphic method
 which will call the typesafe method for the node type such as
 add(Element) or add(Comment).
node - is the given node to addpublic void add(Comment comment)
Comment to this branch. If the given node
 already has a parent defined then an IllegalAddException
 will be thrown.
comment - is the comment to be addedpublic void add(Element element)
Element to this branch. If the given node
 already has a parent defined then an IllegalAddException
 will be thrown.
element - is the element to be addedpublic void add(ProcessingInstruction pi)
ProcessingInstruction to this branch. If
 the given node already has a parent defined then an
 IllegalAddException will be thrown.
pi - is the processing instruction to be addedpublic boolean remove(Node node)
Node if the node is an immediate child
 of this branch. If the given node is not an immediate child of this
 branch then the Node.detach()method should be used instead. This
 is a polymorphic method which will call the typesafe method for the node
 type such as remove(Element) or remove(Comment).
node - is the given node to be removed
public boolean remove(Comment comment)
Comment if the node is an immediate
 child of this branch. If the given node is not an immediate child of this
 branch then the Node.detach()method should be used instead.
comment - is the comment to be removed
public boolean remove(Element element)
Element if the node is an immediate
 child of this branch. If the given node is not an immediate child of this
 branch then the Node.detach()method should be used instead.
element - is the element to be removed
public boolean remove(ProcessingInstruction pi)
ProcessingInstruction if the node is an
 immediate child of this branch. If the given node is not an immediate
 child of this branch then the Node.detach()method should be used
 instead.
pi - is the processing instruction to be removed
public void normalize()
Text nodes in the full depth of the sub-tree
 underneath this Node, including attribute nodes, into a
 "normal" form where only structure (e.g., elements, comments, processing
 instructions, CDATA sections, and entity references) separates
 Text nodes, i.e., there are neither adjacent
 Text nodes nor empty Text nodes. This can
 be used to ensure that the DOM view of a document is the same as if it
 were saved and re-loaded, and is useful when operations (such as XPointer
 lookups) that depend on a particular document tree structure are to be
 used.In cases where the document contains CDATASections,
 the normalize operation alone may not be sufficient, since XPointers do
 not differentiate between Text nodes and
 CDATASection nodes.
| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||