org.codehaus.staxmate.in
Class SMElementInfo

java.lang.Object
  extended by org.codehaus.staxmate.in.SMElementInfo
Direct Known Subclasses:
DefaultElementInfo

public abstract class SMElementInfo
extends java.lang.Object

This is the abstract base class that defines standard set of element information stored when element tracking is enabled for a SMInputCursor. Note that all information is actually optional for implementations; some implementations may want to minimize memory usage and store only some of properties that are accessible via base API. The reason for including "full" set of properties is convenience; there is no need to upcast as the base class has necesary accessors.

Author:
Tatu Saloranta

Constructor Summary
SMElementInfo()
           
 
Method Summary
abstract  int getDepth()
          Optional operation that will return number of parent start elements this element has, if any.
abstract  int getElementIndex()
          Optional operation that will return the zero-based index of the element amongst all (start) elements iterated over by the iterator that created this element info object.
abstract  java.lang.String getLocalName()
          Optional operation that will return the local name of the element, or, if namespace support was not enabled for the parser, full name including possible namespace prefix.
abstract  java.lang.String getNamespaceURI()
          Optional operation that will return the URI of the namespace of the element; this will be empty String ("") for the default namespace (if none declared), or if namespace support was not enabled for the parser.
abstract  int getNodeIndex()
          Optional operation that will return the zero-based index of the element node amongst all nodes iterated over by the iterator that created this element info object.
abstract  SMElementInfo getParent()
          Optional operation that will return information about the parent element of this element, if one exists; null if not (case for the root element).
abstract  java.lang.String getPrefix()
          Optional operation that will return the prefix of the element, if it had one and namespace support was enabled for the parser.
abstract  SMElementInfo getPreviousSibling()
          Optional operation that will return information about the previous sibling in the sibling element chain.
 boolean isFirstChild()
           
 boolean isRoot()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMElementInfo

public SMElementInfo()
Method Detail

getParent

public abstract SMElementInfo getParent()
Optional operation that will return information about the parent element of this element, if one exists; null if not (case for the root element). If not implemented, needs to return null


getPreviousSibling

public abstract SMElementInfo getPreviousSibling()
Optional operation that will return information about the previous sibling in the sibling element chain. Depending on iterator, this may contain only those elements iterator returned (that filter accepted), or all elements iterator traversed over. If not implemented, needs to return null


isRoot

public boolean isRoot()

isFirstChild

public boolean isFirstChild()

getNodeIndex

public abstract int getNodeIndex()
Optional operation that will return the zero-based index of the element node amongst all nodes iterated over by the iterator that created this element info object. If not implemented, needs to return -1.


getElementIndex

public abstract int getElementIndex()
Optional operation that will return the zero-based index of the element amongst all (start) elements iterated over by the iterator that created this element info object. If not implemented, needs to return -1.

Note that the element indices for consequtive elements stored may not be consequtive, if the iterator filtered out some elements.


getDepth

public abstract int getDepth()
Optional operation that will return number of parent start elements this element has, if any. If not implemented, needs to return -1.


getNamespaceURI

public abstract java.lang.String getNamespaceURI()
Optional operation that will return the URI of the namespace of the element; this will be empty String ("") for the default namespace (if none declared), or if namespace support was not enabled for the parser. If operation is not implemented, needs to return null.


getLocalName

public abstract java.lang.String getLocalName()
Optional operation that will return the local name of the element, or, if namespace support was not enabled for the parser, full name including possible namespace prefix. If operation is not implemented, needs to return null.


getPrefix

public abstract java.lang.String getPrefix()
Optional operation that will return the prefix of the element, if it had one and namespace support was enabled for the parser. Otherwise will return null. If operation is not implemented, needs to return null.

Returns:
Namespace prefix of the element; or null if either name space support was not enabled, or if the element had no namespace prefix (ie. uses the default namespace)