com.thoughtworks.xstream.io
Interface HierarchicalStreamReader

All Known Implementing Classes:
AbstractDocumentReader, AbstractPullReader, AbstractXmlReader, BinaryStreamReader, Dom4JReader, DomReader, JDomReader, PathTrackingReader, ReaderWrapper, StaxReader, XomReader, XppDomReader, XppReader

public interface HierarchicalStreamReader

Author:
Joe Walnes

Method Summary
 void appendErrors(ErrorWriter errorWriter)
          If any errors are detected, allow the reader to add any additional information that can aid debugging (such as line numbers, XPath expressions, etc).
 void close()
          Close the reader, if necessary.
 java.lang.String getAttribute(int index)
          Get the value of an attribute of the current node, by index.
 java.lang.String getAttribute(java.lang.String name)
          Get the value of an attribute of the current node.
 int getAttributeCount()
          Number of attributes in current node.
 java.lang.String getAttributeName(int index)
          Name of attribute in current node.
 java.util.Iterator getAttributeNames()
          Names of attributes (as Strings).
 java.lang.String getNodeName()
          Get the name of the current node.
 java.lang.String getValue()
          Get the value (text content) of the current node.
 boolean hasMoreChildren()
          Does the node have any more children remaining that have not yet been read?
 void moveDown()
           
 void moveUp()
           
 HierarchicalStreamReader underlyingReader()
          Return the underlying HierarchicalStreamReader implementation.
 

Method Detail

hasMoreChildren

boolean hasMoreChildren()
Does the node have any more children remaining that have not yet been read?


moveDown

void moveDown()

moveUp

void moveUp()

getNodeName

java.lang.String getNodeName()
Get the name of the current node.


getValue

java.lang.String getValue()
Get the value (text content) of the current node.


getAttribute

java.lang.String getAttribute(java.lang.String name)
Get the value of an attribute of the current node.


getAttribute

java.lang.String getAttribute(int index)
Get the value of an attribute of the current node, by index.


getAttributeCount

int getAttributeCount()
Number of attributes in current node.


getAttributeName

java.lang.String getAttributeName(int index)
Name of attribute in current node.


getAttributeNames

java.util.Iterator getAttributeNames()
Names of attributes (as Strings).


appendErrors

void appendErrors(ErrorWriter errorWriter)
If any errors are detected, allow the reader to add any additional information that can aid debugging (such as line numbers, XPath expressions, etc).


close

void close()
Close the reader, if necessary.


underlyingReader

HierarchicalStreamReader underlyingReader()
Return the underlying HierarchicalStreamReader implementation.

If a Converter needs to access methods of a specific HierarchicalStreamReader implementation that are not defined in the HierarchicalStreamReader interface, it should call this method before casting. This is because the reader passed to the Converter is often wrapped/decorated by another implementation to provide additional functionality (such as XPath tracking).

For example:

MySpecificReader mySpecificReader = (MySpecificReader)reader; // INCORRECT!
 mySpecificReader.doSomethingSpecific();
MySpecificReader mySpecificReader = (MySpecificReader)reader.underlyingReader();  // CORRECT!
 mySpecificReader.doSomethingSpecific();

Implementations of HierarchicalStreamReader should return 'this', unless they are a decorator, in which case they should delegate to whatever they are wrapping.



Joe Walnes, http://xstream.codehaus.org/