public abstract class

AbstractDocumentReader

extends AbstractXmlReader
implements DocumentReader
java.lang.Object
   ↳ com.thoughtworks.xstream.io.xml.AbstractXmlReader
     ↳ com.thoughtworks.xstream.io.xml.AbstractDocumentReader
Known Direct Subclasses

Summary

Protected Constructors
AbstractDocumentReader(Object rootElement)
AbstractDocumentReader(Object rootElement, XmlFriendlyReplacer replacer)
Public Methods
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.
Iterator getAttributeNames()
Names of attributes (as Strings).
Object getCurrent()
Retrieve the current processed node of the DOM.
boolean hasMoreChildren()
Does the node have any more children remaining that have not yet been read?
void moveDown()
Select the current child as current node.
void moveUp()
Select the parent node as current node.
Object peekUnderlyingNode()
This method is deprecated. As of 1.2, use getCurrent()
HierarchicalStreamReader underlyingReader()
Return the underlying HierarchicalStreamReader implementation.
Protected Methods
abstract Object getChild(int index)
abstract int getChildCount()
abstract Object getParent()
abstract void reassignCurrentElement(Object current)
[Expand]
Inherited Methods
From class com.thoughtworks.xstream.io.xml.AbstractXmlReader
From class java.lang.Object
From interface com.thoughtworks.xstream.io.HierarchicalStreamReader
From interface com.thoughtworks.xstream.io.xml.DocumentReader
From interface com.thoughtworks.xstream.io.xml.XmlFriendlyReader

Protected Constructors

protected AbstractDocumentReader (Object rootElement)

protected AbstractDocumentReader (Object rootElement, XmlFriendlyReplacer replacer)

Public Methods

public 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).

public void close ()

Close the reader, if necessary.

public Iterator getAttributeNames ()

Names of attributes (as Strings).

public Object getCurrent ()

Retrieve the current processed node of the DOM.

Returns
  • the current node

public boolean hasMoreChildren ()

Does the node have any more children remaining that have not yet been read?

public void moveDown ()

Select the current child as current node. A call to this function must be balanced with a call to moveUp().

public void moveUp ()

Select the parent node as current node.

public Object peekUnderlyingNode ()

This method is deprecated.
As of 1.2, use getCurrent()

public 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.

Protected Methods

protected abstract Object getChild (int index)

protected abstract int getChildCount ()

protected abstract Object getParent ()

protected abstract void reassignCurrentElement (Object current)