nu.xom
Class LeafNode

java.lang.Object
  extended bynu.xom.Node
      extended bynu.xom.LeafNode
Direct Known Subclasses:
Comment, DocType, ProcessingInstruction, Text

public abstract class LeafNode
extends Node

This class represents the leaf nodes in an XML document; i.e. those tree nodes that cannot have children:

Version:
1.0d13
Author:
Elliotte Rusty Harold

Method Summary
 Node getChild(int position)
           Throws IndexOutOfBoundsException because leaf nodes do not have children.
 int getChildCount()
           Returns 0 because leaf nodes do not have children.
 boolean hasChildren()
           Returns false because leaf nodes do not have children.
 
Methods inherited from class nu.xom.Node
checkDetach, copy, detach, equals, getBaseURI, getDocument, getParent, getValue, hashCode, toString, toXML
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

hasChildren

public final boolean hasChildren()

Returns false because leaf nodes do not have children.

Specified by:
hasChildren in class Node
Returns:
false
See Also:
ParentNode.hasChildren()

getChild

public final Node getChild(int position)

Throws IndexOutOfBoundsException because leaf nodes do not have children.

Specified by:
getChild in class Node
Parameters:
position - the index of the child node to return
Returns:
never returns because leaf nodes do not have children. Always throws an exception.
Throws:
java.lang.IndexOutOfBoundsException - because leaf nodes do not have children

getChildCount

public final int getChildCount()

Returns 0 because leaf nodes do not have children.

Specified by:
getChildCount in class Node
Returns:
zero
See Also:
ParentNode.getChildCount()


Copyright 2002-2004 Elliotte Rusty Harold
elharo@metalab.unc.edu