Save This Page
Home » dom4j-1.6.1 » org.dom4j » [javadoc | source]
org.dom4j
public interface: Branch [javadoc | source]

All Implemented Interfaces:
    Node

All Known Implementing Classes:
    BaseElement, Document, DOMDocument, NonLazyElement, DatatypeElement, DefaultElement, DOMElement, AbstractElement, AbstractDocument, UserDataElement, BeanElement, LElement, IndexedElement, DefaultDocument, AbstractBranch, Element

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).

Method from org.dom4j.Branch Summary:
add,   add,   add,   add,   addElement,   addElement,   addElement,   appendContent,   clearContent,   content,   elementByID,   indexOf,   node,   nodeCount,   nodeIterator,   normalize,   processingInstruction,   processingInstructions,   processingInstructions,   remove,   remove,   remove,   remove,   removeProcessingInstruction,   setContent,   setProcessingInstructions
Method from org.dom4j.Branch Detail:
 public  void add(Node node)
    Adds the given 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).
 public  void add(Comment comment)
    Adds the given Comment to this branch. If the given node already has a parent defined then an IllegalAddException will be thrown.
 public  void add(Element element)
    Adds the given Element to this branch. If the given node already has a parent defined then an IllegalAddException will be thrown.
 public  void add(ProcessingInstruction pi)
    Adds the given ProcessingInstruction to this branch. If the given node already has a parent defined then an IllegalAddException will be thrown.
 public Element addElement(String name)
    Adds a new Element node with the given name to this branch and returns a reference to the new node.
 public Element addElement(QName qname)
    Adds a new Element node with the given QName to this branch and returns a reference to the new node.
 public Element addElement(String qualifiedName,
    String namespaceURI)
    Adds a new Element node with the given qualified name and namespace URI to this branch and returns a reference to the new node.
 public  void appendContent(Branch branch)
 public  void clearContent()
    Clears the content for this branch, removing any Node instances this branch may contain.
 public List content()

    Returns the content nodes of this branch as a backed List so that the content of this branch may be modified directly using the List interface. The List is backed by the Branch so that changes to the list are reflected in the branch and vice versa.

 public Element elementByID(String elementID)
    Returns the element of the given ID attribute value. If this tree is capable of understanding which attribute value should be used for the ID then it should be used, otherwise this method should return null.
 public 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.
 public Node node(int index) throws IndexOutOfBoundsException
    Returns the Node at the specified index position.
 public int nodeCount()
    Returns the number of Node instances that this branch contains.
 public Iterator nodeIterator()
    Returns an iterator through the content nodes of this branch
 public  void normalize()
    Puts all 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.
 public ProcessingInstruction processingInstruction(String target)
    DOCUMENT ME!
 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.

 public boolean remove(Node node)
    Removes the given 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).
 public boolean remove(Comment comment)
    Removes the given 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.
 public boolean remove(Element element)
    Removes the given 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.
 public boolean remove(ProcessingInstruction pi)
    Removes the given 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.
 public boolean removeProcessingInstruction(String target)
    Removes the processing instruction for the given target if it exists
 public  void setContent(List content)
    Sets the contents of this branch as a List of Node instances.
 public  void setProcessingInstructions(List listOfPIs)
    Sets all the processing instructions for this branch