Class com.ibm.xml.parser.Parent
java.lang.Object
|
+----com.ibm.xml.parser.Child
|
+----com.ibm.xml.parser.Parent
- Subclasses:
- DTD, GeneralReference, TXDocument, TXElement
- public abstract class Parent
- extends Child
The Parent class extends Child and provides services in support of non-leaf Nodes.
- Version:
- Revision: 15 1.4 src/com/ibm/xml/parser/Parent.java, xml4jsrc, xml4j-jtcsv, xml4j_1_0_4
- See Also:
- TXElement, TXDocument, DTD, Child, Node
Method Summary
|
void
|
addElement(Child newChild)
Inserts the specified Node as the last Child in this Node's list of children.
|
java.util.Enumeration
|
elements()
Return an Enumeration instance of all children of this Node.
|
NodeIterator
|
getChildNodes()
Returns a NodeIterator object that will enumerate all children of this Node.
|
Child[]
|
getChildrenArray()
Return an array of Child Nodes for all children of this Node.
|
Node
|
getFirstChild()
Returns the first Child of this Node.
|
boolean
|
hasChildNodes()
Returns true if this Node has any children, or false if this Node has no children at all.
|
void
|
insert(Child child,
int index)
Insert a Child Node into the specified position in this Node's list of children.
|
Node
|
insertAfter(Node newChild,
Node refChild)
Inserts a Child Node (newChild) after the existing Child Node (refChild).
|
Node
|
insertBefore(Node newChild,
Node refChild)
Inserts a Child Node (newChild) before the existing Child Node (refChild).
|
Node
|
insertFirst(Node newChild)
Inserts the specified Node as the first Child in this Node's list of children.
|
Node
|
insertLast(Node newChild)
Inserts the specified Node as the last Child in this Node's list of children.
|
Node
|
removeChild(Node oldChild)
Removes the Child Node indicated by oldChild from this Nodes list of children, and returns it.
|
Node
|
replaceChild(Node newChild,
Node oldChild)
Replaces the Child Node oldChild with newChild in this Node's list of children, and return
the oldChild Node.
|
Methods inherited from class com.ibm.xml.parser.Child
|
clearDigest, clone, getChildNodes, getDigest, getFactory, getFirstChild, getNextSibling, getParentNode, getPreviousSibling, getText, hasChildNodes, insertBefore, makeXPointer, print, print, removeChild, replaceChild, searchAncestors, searchAncestors, setFactory, toXMLString, toXMLString |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Parent
public Parent()
getChildNodes
public NodeIterator getChildNodes()
- Returns a NodeIterator object that will enumerate all children of this Node. If there
are no children, an empty iterator is returned. The content of the
returned NodeIterator is "live" in the sense that changes to the children of the Node
object that it was created from will be immediately reflected in the Nodes returned by
the iterator; it is not a static snapshot of the content of the Node. Similarly, changes
made to the Nodes returned by the iterator will be immediately reflected in the tree,
including the set of children of the Node that the NodeIterator was created from.
This method is defined by DOM.
- Returns:
- An iterator of all children of this Parent Node.
- Overrides:
- getChildNodes in class Child
- See Also:
- hasChildNodes, elements, getFirstChild, getChildrenArray
hasChildNodes
public boolean hasChildNodes()
- Returns true if this Node has any children, or false if this Node has no children at all.
This method exists both for convenience as well as to allow implementations to be able
to bypass object allocation, which may be required for implementing getChildNodes().
This method is defined by DOM.
- Returns:
- True if any children exist; otherwise, returns false.
- Overrides:
- hasChildNodes in class Child
- See Also:
- getChildNodes, elements, getFirstChild, getChildrenArray
elements
public java.util.Enumeration elements()
- Return an Enumeration instance of all children of this Node.
- Returns:
- An enumeration of all children of this Parent Node, or null if no children.
- See Also:
- hasChildNodes, getChildNodes, getFirstChild, getChildrenArray
getChildrenArray
public Child[] getChildrenArray()
- Return an array of Child Nodes for all children of this Node.
- Returns:
- An array of all children of this Parent Node, or null if no children.
- See Also:
- hasChildNodes, getChildNodes, getFirstChild, elements
getFirstChild
public Node getFirstChild()
- Returns the first Child of this Node. If there are no children, null is returned.
This method is defined by DOM.
- Returns:
- The first Child of this Parent Node, or null if no children.
- Overrides:
- getFirstChild in class Child
- See Also:
- hasChildNodes, getChildNodes, elements
insert
public void insert(Child child,
int index) throws NoSuchNodeException
- Insert a Child Node into the specified position in this Node's list of children.
- Parameters:
Child
- The Child Node being inserted.
index
- 0-based index into the list of children.
- Throws:
- NoSuchNodeException - Thrown if index is not valid.
- See Also:
- insertBefore, insertAfter, insertFirst, insertLast
insertBefore
public Node insertBefore(Node newChild,
Node refChild) throws NotMyChildException
- Inserts a Child Node (newChild) before the existing Child Node (refChild). If refChild is null, insert
newChild at the end of the list of children. If refChild is not a Child of this Node,
a NotMyChildException is thrown.
This method is defined by DOM.
- Parameters:
newChild
- The Child Node being inserted.
refChild
- The Child Node to insert newChild before, or null if newChild is to be inserted at the end of the Child list.
- Returns:
- The Child Node being inserted.
- Throws:
- NotMyChildException - Thrown if refChild is not a Child of this object.
- Overrides:
- insertBefore in class Child
- See Also:
- insert, insertAfter, insertFirst, insertLast
insertAfter
public Node insertAfter(Node newChild,
Node refChild) throws NotMyChildException
- Inserts a Child Node (newChild) after the existing Child Node (refChild). If refChild is null, insert
newChild at the beginning of the list of children. If refChild is not a Child of this Node,
a NotMyChildException is thrown.
- Parameters:
newChild
- The Child Node being inserted.
refChild
- The Child Node to insert newChild after, or null if newChild is to be inserted at the beginning of the Child list.
- Returns:
- The Child Node being inserted.
- Throws:
- NotMyChildException - Thrown if refChild is not a Child of this object.
- See Also:
- insertBefore, insert, insertFirst, insertLast
insertFirst
public Node insertFirst(Node newChild)
- Inserts the specified Node as the first Child in this Node's list of children.
- Parameters:
newChild
- The Child Node being inserted.
- Returns:
- The Child Node being inserted.
- See Also:
- insertBefore, insertAfter, insert, insertLast
insertLast
public Node insertLast(Node newChild)
- Inserts the specified Node as the last Child in this Node's list of children.
- Parameters:
newChild
- The Child Node being inserted.
- Returns:
- The Child Node being inserted.
- See Also:
- insertBefore, insertAfter, insertFirst, insert, addElement
addElement
public void addElement(Child newChild)
- Inserts the specified Node as the last Child in this Node's list of children.
- Parameters:
newChild
- The Child Node being inserted.
- Returns:
- The Child Node being inserted.
- See Also:
- insertBefore, insertAfter, insertFirst, insert, insertLast
replaceChild
public Node replaceChild(Node newChild,
Node oldChild) throws NotMyChildException
- Replaces the Child Node oldChild with newChild in this Node's list of children, and return
the oldChild Node. If oldChild was not already a Child of this Node,
a NotMyChildException is thrown.
This method is defined by DOM.
- Parameters:
newChild
- The Child Node to replace with.
oldChild
- The Child Node being replaced.
- Returns:
- The Child Node being replaced.
- Throws:
- NotMyChildException - Thrown if oldChild is not a Child of this object.
- Overrides:
- replaceChild in class Child
- See Also:
- removeChild
removeChild
public Node removeChild(Node oldChild) throws NotMyChildException
- Removes the Child Node indicated by oldChild from this Nodes list of children, and returns it. If oldChild
was not a Child of this Node, a NotMyChildException is thrown.
This method is defined by DOM.
- Parameters:
oldChild
- The Child Node being removed.
- Returns:
- The Child Node being removed.
- Throws:
- NotMyChildException - Thrown if oldChild is not a Child of this object.
- Overrides:
- removeChild in class Child
- See Also:
- replaceChild