com.thoughtworks.xstream.io.xml
Class AbstractPullReader

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.AbstractPullReader
All Implemented Interfaces:
ErrorReporter, ExtendedHierarchicalStreamReader, HierarchicalStreamReader
Direct Known Subclasses:
StaxReader, XppReader

public abstract class AbstractPullReader
extends AbstractXmlReader

Base class that contains common functionality across HierarchicalStreamReader implementations that need to read from a pull parser.

Author:
Joe Walnes, James Strachan

Field Summary
protected static int COMMENT
           
protected static int END_NODE
           
protected static int OTHER
           
protected static int START_NODE
           
protected static int TEXT
           
 
Constructor Summary
protected AbstractPullReader(NameCoder nameCoder)
           
protected AbstractPullReader(XmlFriendlyReplacer replacer)
          Deprecated. As of 1.4 use AbstractPullReader(NameCoder) instead
 
Method Summary
 Iterator getAttributeNames()
          Names of attributes (as Strings).
 String getNodeName()
          Get the name of the current node.
 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 mark()
           
 void moveDown()
          Select the current child as current node.
 void moveUp()
          Select the parent node as current node.
 String peekNextChild()
          Peek the name of the next child.
protected abstract  String pullElementName()
          Pull the name of the current element from the stream.
protected abstract  int pullNextEvent()
          Pull the next event from the stream.
protected abstract  String pullText()
          Pull the contents of the current text node from the stream.
 void reset()
           
 
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, 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
appendErrors, close, getAttribute, getAttribute, getAttributeCount, getAttributeName
 

Field Detail

START_NODE

protected static final int START_NODE
See Also:
Constant Field Values

END_NODE

protected static final int END_NODE
See Also:
Constant Field Values

TEXT

protected static final int TEXT
See Also:
Constant Field Values

COMMENT

protected static final int COMMENT
See Also:
Constant Field Values

OTHER

protected static final int OTHER
See Also:
Constant Field Values
Constructor Detail

AbstractPullReader

protected AbstractPullReader(NameCoder nameCoder)
Since:
1.4

AbstractPullReader

protected AbstractPullReader(XmlFriendlyReplacer replacer)
Deprecated. As of 1.4 use AbstractPullReader(NameCoder) instead

Since:
1.2
Method Detail

pullNextEvent

protected abstract int pullNextEvent()
Pull the next event from the stream.

This MUST return START_NODE, END_NODE, TEXT, COMMENT, OTHER or throw StreamException.

The underlying pull parser will most likely return its own event types. These must be mapped to the appropriate events.


pullElementName

protected abstract String pullElementName()
Pull the name of the current element from the stream.


pullText

protected abstract String pullText()
Pull the contents of the current text node from the stream.


hasMoreChildren

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


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


moveUp

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


mark

public void mark()

reset

public void reset()

getValue

public String getValue()
Description copied from interface: HierarchicalStreamReader
Get the value (text content) of the current node.


getAttributeNames

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


getNodeName

public String getNodeName()
Description copied from interface: HierarchicalStreamReader
Get the name of the current node.


peekNextChild

public String peekNextChild()
Description copied from interface: ExtendedHierarchicalStreamReader
Peek the name of the next child. In situation where HierarchicalStreamReader.hasMoreChildren() returns true, peek the tag name of the child.

Specified by:
peekNextChild in interface ExtendedHierarchicalStreamReader
Overrides:
peekNextChild in class AbstractReader


Copyright © 2004-2014 XStream. All Rights Reserved.