com.thoughtworks.xstream.io.xml
Class AbstractDocumentReader

java.lang.Object
  extended by com.thoughtworks.xstream.io.AbstractReader
      extended by com.thoughtworks.xstream.io.xml.AbstractXmlReader
          extended by com.thoughtworks.xstream.io.xml.AbstractDocumentReader
All Implemented Interfaces:
ErrorReporter, ExtendedHierarchicalStreamReader, HierarchicalStreamReader, DocumentReader
Direct Known Subclasses:
Dom4JReader, DomReader, JDomReader, XomReader, XppDomReader

public abstract class AbstractDocumentReader
extends AbstractXmlReader
implements DocumentReader


Constructor Summary
protected AbstractDocumentReader(Object rootElement)
           
protected AbstractDocumentReader(Object rootElement, NameCoder nameCoder)
           
protected AbstractDocumentReader(Object rootElement, XmlFriendlyReplacer replacer)
          Deprecated. As of 1.4, use AbstractDocumentReader(Object, NameCoder) instead.
 
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.
 Iterator getAttributeNames()
          Names of attributes (as Strings).
protected abstract  Object getChild(int index)
           
protected abstract  int getChildCount()
           
 Object getCurrent()
          Retrieve the current processed node of the DOM.
protected abstract  Object getParent()
           
 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.
protected abstract  void reassignCurrentElement(Object current)
           
 
Methods inherited from class com.thoughtworks.xstream.io.xml.AbstractXmlReader
escapeXmlName, unescapeXmlName
 
Methods inherited from class com.thoughtworks.xstream.io.AbstractReader
decodeAttribute, decodeNode, encodeAttribute, encodeNode, peekNextChild, underlyingReader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.thoughtworks.xstream.io.HierarchicalStreamReader
getAttribute, getAttribute, getAttributeCount, getAttributeName, getNodeName, getValue, underlyingReader
 

Constructor Detail

AbstractDocumentReader

protected AbstractDocumentReader(Object rootElement)

AbstractDocumentReader

protected AbstractDocumentReader(Object rootElement,
                                 NameCoder nameCoder)
Since:
1.4

AbstractDocumentReader

protected AbstractDocumentReader(Object rootElement,
                                 XmlFriendlyReplacer replacer)
Deprecated. As of 1.4, use AbstractDocumentReader(Object, NameCoder) instead.

Since:
1.2
Method Detail

reassignCurrentElement

protected abstract void reassignCurrentElement(Object current)

getParent

protected abstract Object getParent()

getChild

protected abstract Object getChild(int index)

getChildCount

protected abstract int getChildCount()

hasMoreChildren

public boolean hasMoreChildren()
Description copied from interface: HierarchicalStreamReader
Does the node have any more children remaining that have not yet been read?

Specified by:
hasMoreChildren in interface HierarchicalStreamReader

moveUp

public void moveUp()
Description copied from interface: HierarchicalStreamReader
Select the parent node as current node.

Specified by:
moveUp in interface HierarchicalStreamReader

moveDown

public void moveDown()
Description copied from interface: HierarchicalStreamReader
Select the current child as current node. A call to this function must be balanced with a call to HierarchicalStreamReader.moveUp().

Specified by:
moveDown in interface HierarchicalStreamReader

getAttributeNames

public Iterator getAttributeNames()
Description copied from interface: HierarchicalStreamReader
Names of attributes (as Strings).

Specified by:
getAttributeNames in interface HierarchicalStreamReader

appendErrors

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

Specified by:
appendErrors in interface ErrorReporter
Specified by:
appendErrors in interface HierarchicalStreamReader
Parameters:
errorWriter - the error writer

getCurrent

public Object getCurrent()
Description copied from interface: DocumentReader
Retrieve the current processed node of the DOM.

Specified by:
getCurrent in interface DocumentReader
Returns:
the current node

close

public void close()
Description copied from interface: HierarchicalStreamReader
Close the reader, if necessary.

Specified by:
close in interface HierarchicalStreamReader


Copyright © 2004-2014 XStream. All Rights Reserved.