org.apache.xalan.stree
Class Parent

java.lang.Object
  |
  +--org.apache.xml.utils.UnImplNode
        |
        +--org.apache.xalan.stree.Child
              |
              +--org.apache.xalan.stree.Parent
Direct Known Subclasses:
DocImpl, ElementImpl

public class Parent
extends Child

**For internal use only** Class representing a parent node. A parent is also a child unless it is the root node.


Constructor Summary
Parent(DocumentImpl doc)
          Constructor Parent
 
Method Summary
 Node appendChild(Node newChild)
          Append a child to the child list.
 void dispatchCharactersEvent(ContentHandler ch)
          Handle a Characters event
 Child getChild(int i)
          Get the nth child.
 int getChildCount()
          Get the number of children this node currently contains.
 int getChildUID(int pos)
          **For internal use only** Get the position of the child of an element in the document.
 Node getFirstChild()
          The first child of this node.
 Node getLastChild()
          The last child of this node.
 boolean hasChildNodes()
          This is a convenience method to allow easy determination of whether a node has any children.
 boolean isComplete()
          Return if this node has had all it's children added, i.e.
 void setComplete(boolean isComplete)
          Set that this node's child list is complete, i.e.
 
Methods inherited from class org.apache.xalan.stree.Child
getAttributes, getLevel, getLocalName, getNamespaceURI, getNextSibling, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTagName, getUid, isNamespaceNode, isSupported, setAttribute, setLevel
 
Methods inherited from class org.apache.xml.utils.UnImplNode
appendData, cloneNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, error, error, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getChildNodes, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, getLength, getNodeName, getNodeType, getNodeValue, getOwnerElement, getSpecified, hasAttribute, hasAttributeNS, hasAttributes, importNode, insertBefore, insertData, item, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, replaceData, setAttributeNode, setAttributeNodeNS, setAttributeNS, setData, setNodeValue, setPrefix, setValue, splitText, substringData
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parent

public Parent(DocumentImpl doc)
Constructor Parent
Parameters:
doc - Document object
Method Detail

getChildCount

public int getChildCount()
Get the number of children this node currently contains. Note that this will only return the number of children added so far. If the isComplete property is false, it is likely that more children will be added. DON'T CALL THIS FUNCTION IF YOU CAN HELP IT!!!
Returns:
number of children this node currently contains

hasChildNodes

public boolean hasChildNodes()
This is a convenience method to allow easy determination of whether a node has any children.
Returns:
true if the node has any children, false if the node has no children.
Overrides:
hasChildNodes in class Child

getChildUID

public int getChildUID(int pos)
**For internal use only** Get the position of the child of an element in the document. Note that this is assuming an index starting at 1
Parameters:
pos - Position of the child in this parent's children list
Returns:
the position of this child in the document or -1 if the child is not found

getChild

public Child getChild(int i)
               throws java.lang.ArrayIndexOutOfBoundsException,
                      java.lang.NullPointerException
Get the nth child.
Parameters:
i - the index of the child.
Returns:
The child node at the specified position or null if none found
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is out of bounds.
java.lang.NullPointerException - if there are no children.

getFirstChild

public Node getFirstChild()
The first child of this node. If there is no such node, this returns null.
Returns:
The first child of this parent or null if none found
Overrides:
getFirstChild in class Child

getLastChild

public Node getLastChild()
The last child of this node. If there is no such node, this returns null.
Returns:
The last child of this parent
Overrides:
getLastChild in class Child

appendChild

public Node appendChild(Node newChild)
                 throws DOMException
Append a child to the child list.
Parameters:
newChild - Must be a org.apache.xalan.stree.Child.
Returns:
The node we just added to this parent's children list
Throws:
java.lang.ClassCastException - if the newChild isn't a org.apache.xalan.stree.Child.
DOMException -  
Overrides:
appendChild in class UnImplNode

isComplete

public boolean isComplete()
Return if this node has had all it's children added, i.e. if a endElement event has occured.
Returns:
whether this node has had all it's children added or not
Overrides:
isComplete in class Child

setComplete

public void setComplete(boolean isComplete)
Set that this node's child list is complete, i.e. an endElement event has occured.
Parameters:
isComplete - flag indicating whether this node has had all it's children added
Overrides:
setComplete in class Child

dispatchCharactersEvent

public void dispatchCharactersEvent(ContentHandler ch)
                             throws SAXException
Handle a Characters event
Parameters:
ch - Content handler to handle SAX events
Throws:
SAXException - if the content handler characters event throws a SAXException.
Overrides:
dispatchCharactersEvent in class Child


Copyright � 2000 Apache XML Project. All Rights Reserved.