Contents | Package | Class | Tree | Deprecated | Index | Help | XML for Java
PREV | NEXT | SHOW LISTS | HIDE LISTS |

# Class com.ibm.xml.parser.Child

    java.lang.Object
        |
        +----com.ibm.xml.parser.Child

Subclasses:
  AttDef, Attlist, ElementDecl, Entity, Parent, PseudoNode, TXAttribute, TXComment, TXNotation, TXPI, TXText

public abstract class Child
extends java.lang.Object
implements Node, java.lang.Cloneable, java.io.Serializable

The Child class implements the Node interface as defined by the Document Object Model (DOM).

Node is the base type of most objects in the Document Object Model. It may have an arbitrary number (including zero) of sequentially ordered Child Nodes. It usually has a parent Node; the exception being that the root Node in a document hierarchy has no parent.

Version:
  1.1
See Also:
  Node, TXElement, TXText, TXComment, TXPI, TXCDATASection, TXNotation, TXAttribute, Parent

Field Summary
static int | ATTDEF
static int | ATTLIST
static int | DOCUMENTTYPE
static int | ELEMENTDEFINITION
static int | ENTITY
static int | GENERALREFERENCE
static int | NOTATION
static int | PSEUDONODE

Constructor Summary
Child()

Method Summary
void | clearDigest() Clears the digest value for this Node and any ancestors.
java.lang.Object | clone() Clone this object.
NodeIterator | getChildNodes() Returns an empty NodeIterator object because Child Nodes are leaf Nodes.
byte[] | getDigest() Returns the digest value for this Node and any children.
ElementFactory | getFactory() Returns the factory used for creating this Node.
Node | getFirstChild() Returns null because Child Nodes are leaf Nodes.
Node | getNextSibling() Returns the Node immediately following this Node in a breadth-first traversal of the tree.
Node | getParentNode() Returns the parent of the given Node instance.
Node | getPreviousSibling() Returns the Node immediately preceding this Node in a breadth-first traversal of the tree.
java.lang.String | getText() Returns all text associated with this Node without considering entities.
boolean | hasChildNodes() Returns false because Child Nodes are leaf Nodes.
Node | insertBefore(Node newChild, Node refChild) Throws a NotMyChildException because Child Nodes are leaf Nodes.
XPointer | makeXPointer() Return an XPointer instance representing this node.
void | print(java.io.PrintWriter pw, java.lang.String enc) Print this Node in XML format, using the specified character encoding, and indented by indent spaces.
void | print(java.io.PrintWriter pw) Print this Node in XML format, using the default character encoding, and indented by indent spaces.
Node | removeChild(Node oldChild) Throws a NotMyChildException because Child Nodes are leaf Nodes.
Node | replaceChild(Node oldChild, Node newChild) Throws a NotMyChildException because Child Nodes are leaf Nodes.
TXElement | searchAncestors(java.lang.String qName) Returns the first TXElement match through all ancestors.
TXElement | searchAncestors(int matchType, java.lang.String uri, java.lang.String qNameOrLocalName) Returns the first TXElement match through all ancestors.
void | setFactory(ElementFactory factory) Sets the factory to be used in creating this Node.
java.lang.String | toString() Returns this Node in XML format using the default character encoding.
java.lang.String | toString(java.lang.String enc) Returns this Node in XML format using the specified character encoding.

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

### DOCUMENTTYPE

    public static final int DOCUMENTTYPE

### ELEMENTDEFINITION

    public static final int ELEMENTDEFINITION

### ATTLIST

    public static final int ATTLIST

### ATTDEF

    public static final int ATTDEF

### ENTITY

    public static final int ENTITY

### NOTATION

    public static final int NOTATION

### GENERALREFERENCE

    public static final int GENERALREFERENCE

### PSEUDONODE

    public static final int PSEUDONODE

Constructor Detail

### Child

    public Child()

Method Detail

### clone

    public abstract java.lang.Object clone()

  Clone this object.
  Returns:
    Copy of this object.
  Overrides:
    clone in class java.lang.Object

### getParentNode

    public Node getParentNode()

  Returns the parent of the given Node instance. If this Node is the root of the document object tree, or if the Node has not been added to a document tree, null is returned.

  This method is defined by DOM.

  Implements:
    getParentNode in interface Node
  Returns:
    Parent Node associated with this object, or null if no parent.

### getChildNodes

    public NodeIterator getChildNodes()

  Returns an empty NodeIterator object because Child Nodes are leaf Nodes. If the Child class is extended by non-leaf Nodes, this method should be overridden.

  This method is defined by DOM.

  Implements:
    getChildNodes in interface Node
  Returns:
    Always returns an empty Node iterator.
  See Also:
    getChildNodes

### hasChildNodes

    public boolean hasChildNodes()

  Returns false because Child Nodes are leaf Nodes. If the Child class is extended by non-leaf Nodes, this method should be overridden.

  This method is defined by DOM.

  Implements:
    hasChildNodes in interface Node
  Returns:
    Always returns false.
  See Also:
    hasChildNodes

### getFirstChild

    public Node getFirstChild()

  Returns null because Child Nodes are leaf Nodes. If the Child class is extended by non-leaf Nodes, this method should be overridden.

  This method is defined by DOM.

  Implements:
    getFirstChild in interface Node
  Returns:
    Always returns null.
  See Also:
    getFirstChild

### getPreviousSibling

    public Node getPreviousSibling()

  Returns the Node immediately preceding this Node in a breadth-first traversal of the tree. If there is no such Node, null is returned.

  This method is defined by DOM.

  Implements:
    getPreviousSibling in interface Node
  Returns:
    The Child Node immediately preceding this object in the Parent's Child list, or null if this object is the first sibling.
  See Also:
    getNextSibling

### getNextSibling

    public Node getNextSibling()

  Returns the Node immediately following this Node in a breadth-first traversal of the tree. If there is no such Node, null is returned.

  This method is defined by DOM.

  Implements:
    getNextSibling in interface Node
  Returns:
    The Child Node immediately following this object in the parent's Child list, or null if this object is the last sibling.
  See Also:
    getPreviousSibling

### insertBefore

    public Node insertBefore(Node newChild,
                             Node refChild) throws NotMyChildException

  Throws a NotMyChildException because Child Nodes are leaf Nodes. If the Child class is extended by non-leaf Nodes, this method should be overridden.

  This method is defined by DOM.

  Implements:
    insertBefore in interface Node
  Parameters:
    `newChild` - Not used.
    `refChild` - Not used.
  Returns:
    Nothing is ever returned (an exception is thrown).
  Throws:
    NotMyChildException - Thrown to indicate that no children exist in leaf Nodes.
  See Also:
    insertBefore

### replaceChild

    public Node replaceChild(Node oldChild,
                             Node newChild) throws NotMyChildException

  Throws a NotMyChildException because Child Nodes are leaf Nodes. If the Child class is extended by non-leaf Nodes, this method should be overridden.

  This method is defined by DOM.

  Implements:
    replaceChild in interface Node
  Parameters:
    `oldChild` - Not used.
    `newChild` - Not used.
  Returns:
    Nothing is ever returned (an exception is thrown).
  Throws:
    NotMyChildException - Thrown to indicate that no children exist in leaf Nodes.
  See Also:
    replaceChild

### removeChild

    public Node removeChild(Node oldChild) throws NotMyChildException

  Throws a NotMyChildException because Child Nodes are leaf Nodes. If the Child class is extended by non-leaf Nodes, this method should be overridden.

  This method is defined by DOM.

  Implements:
    removeChild in interface Node
  Parameters:
    `oldChild` - Not used.
  Returns:
    Nothing is ever returned (an exception is thrown).
  Throws:
    NotMyChildException - Thrown to indicate that no children exist in leaf Nodes.
  See Also:
    removeChild

### getText

    public java.lang.String getText()

  Returns all text associated with this Node without considering entities. This method is intended to be overridden by DOM-defined Node types.
  Returns:
    Always returns "".
  See Also:
    getText, toString

### searchAncestors

    public TXElement searchAncestors(java.lang.String qName)

  Returns the first TXElement match through all ancestors. Searching is done recursively, not just for the immediate Parent Node. The specified qualified name refers to the Element tag name (see Namespace for details).
  Parameters:
    `qName` - Qualified name to match against in all ancestors.
  Returns:
    The first matching TXElement Node, or null if no matches.
  See Also:
    Namespace

### searchAncestors

    public TXElement searchAncestors(int matchType,
                                     java.lang.String uri,
                                     java.lang.String qNameOrLocalName)

  Returns the first TXElement match through all ancestors. All specified input parameters must match for an Element to be judged as matched (see Namespace for details). Various namespace matching algorithms are supported: qualified name, local name & URI, or URI. Searching is done recursively, not just for the immediate Parent Node.
  Parameters:
    `matchType` - Namespace match type: `Match.QNAME, Match.NSLOCAL, Match.NS`
    `uri` - When matching a URI, specify the value to match; otherwise, specify null.
    `qNameOrLocalName` - When matching a qualified name or local name, specify the value to match; otherwise, specify null.
  Returns:
    The first matching TXElement Node, or null if no matches.
  See Also:
    Namespace

### toString

    public java.lang.String toString()

  Returns this Node in XML format using the default character encoding. Entities embedded in the returned string will be respected. For example, the characters `<, >, &, ', and "` will be represented as `&lt;, &gt;, &amp;, &apos;, &quot;` .
  Returns:
    XML formatted string.
  Overrides:
    toString in class java.lang.Object
  See Also:
    getText, Entity

### toString

    public java.lang.String toString(java.lang.String enc)

  Returns this Node in XML format using the specified character encoding. Entities embedded in the returned string will be respected. For example, the characters `<, >, &, ', and "` will be represented as `&lt;, &gt;, &amp;, &apos;, &quot;` .
  Parameters:
    `enc` - Java character encoding to use.
  Returns:
    XML formatted string.
  See Also:
    getText, Entity

### print

    public void print(java.io.PrintWriter pw,
                      java.lang.String enc)

  Print this Node in XML format, using the specified character encoding, and indented by indent spaces. Entities embedded in the output stream will be respected. For example, the characters `<, >, &, ', and "` will be represented as `&lt;, &gt;, &amp;, &apos;, &quot;` .
  Parameters:
    `pw` - The character output stream to use.
    `enc` - Java character encoding in use by pw.
  See Also:
    Entity

### print

    public void print(java.io.PrintWriter pw)

  Print this Node in XML format, using the default character encoding, and indented by indent spaces. Entities embedded in the output stream will be respected. For example, the characters `<, >, &, ', and "` will be represented as `&lt;, &gt;, &amp;, &apos;, &quot;` .
  Parameters:
    `pw` - The character output stream to use.
  See Also:
    Entity

### getFactory

    public ElementFactory getFactory()

  Returns the factory used for creating this Node.
  Returns:
    The factory used for creating this Node, or null if no factory.
  See Also:
    setFactory

### setFactory

    public void setFactory(ElementFactory factory)

  Sets the factory to be used in creating this Node.
  Parameters:
    `factory` - The factory to be used in creating this Node.
  See Also:
    getFactory

### getDigest

    public byte[] getDigest()

  Returns the digest value for this Node and any children. If no digest value currently exists, calculate it.
  Returns:
    The array of bytes for the resulting hash value.
  See Also:
    clearDigest

### clearDigest

    public void clearDigest()

  Clears the digest value for this Node and any ancestors.
  See Also:
    getDigest

### makeXPointer

    public XPointer makeXPointer()

  Return an XPointer instance representing this node.
  Returns:
    XPointer instance, or null if this node isn't placed in a tree.
  See Also:
    XPointer

Contents | Package | Class | Tree | Deprecated | Index | Help |
PREV | NEXT | SHOW LISTS | HIDE LISTS |