Top Description Fields Constructors Methods
com.thoughtworks.xstream.io.xml

public Class XppReader

extends AbstractPullReader
Class Inheritance
Imports
java.io.IOException, .Reader, org.xmlpull.v1.XmlPullParser, .XmlPullParserException, com.thoughtworks.xstream.converters.ErrorWriter, com.thoughtworks.xstream.io.StreamException, com.thoughtworks.xstream.io.naming.NameCoder

Deprecated

as a consequence of AbstractPullReader being deprecated. See corresponding docs for further information.

XStream reader that pulls directly from the stream using the XmlPullParser API.
Authors
Joe Walnes, Jörg Schaible

Field Summary

Modifier and TypeField and Description
private final XmlPullParser
private final Reader
Inherited from com.thoughtworks.xstream.io.xml.AbstractPullReader:
COMMENTEND_NODEOTHERSTART_NODETEXT

Constructor Summary

AccessConstructor and Description
public
XppReader(Reader
the reader with the input data
reader
,
XmlPullParser
the XPP parser to use
parser
)

Construct an XppReader.

public
XppReader(Reader
the reader with the input data
reader
,
XmlPullParser
the XPP parser to use
parser
,
NameCoder
the coder for XML friendly tag and attribute names
nameCoder
)

Construct an XppReader.

public
XppReader(Reader reader)

Deprecated As of 1.4, use XppReader(Reader, XmlPullParser) instead
public
XppReader(Reader reader, XmlFriendlyReplacer replacer)

Deprecated As of 1.4, use XppReader(Reader, XmlPullParser, NameCoder) instead

Method Summary

Modifier and TypeMethod and Description
public void
appendErrors(ErrorWriter
the error writer
errorWriter
)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.appendErrors.

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

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.close.

Close the reader, if necessary.
protected XmlPullParser
createParser()

Deprecated As of 1.4, use XppReader(Reader, XmlPullParser) instead
To use another implementation of org.xmlpull.v1.XmlPullParser, override this method.
public String
getAttribute(String name)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Get the value of an attribute of the current node.
public String
getAttribute(int index)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Get the value of an attribute of the current node, by index.
public int
public String
getAttributeName(int index)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeName.

Name of attribute in current node.
protected String
pullElementName()

Implements abstract com.thoughtworks.xstream.io.xml.AbstractPullReader.pullElementName.

Pull the name of the current element from the stream.
protected int
pullNextEvent()

Implements abstract com.thoughtworks.xstream.io.xml.AbstractPullReader.pullNextEvent.

Pull the next event from the stream.
protected String
pullText()

Implements abstract com.thoughtworks.xstream.io.xml.AbstractPullReader.pullText.

Pull the contents of the current text node from the stream.
Inherited from com.thoughtworks.xstream.io.xml.AbstractPullReader:
getAttributeNamesgetNodeNamegetValuehasMoreChildrenmarkmoveDownmoveUppeekNextChildreset

Field Detail

parserback to summary
private final XmlPullParser parser
readerback to summary
private final Reader reader

Constructor Detail

XppReaderback to summary
public XppReader(Reader reader, XmlPullParser parser)

Construct an XppReader.

Parameters
reader:Reader

the reader with the input data

parser:XmlPullParser

the XPP parser to use

Since
1.4
XppReaderback to summary
public XppReader(Reader reader, XmlPullParser parser, NameCoder nameCoder)

Construct an XppReader.

Parameters
reader:Reader

the reader with the input data

parser:XmlPullParser

the XPP parser to use

nameCoder:NameCoder

the coder for XML friendly tag and attribute names

Since
1.4
XppReaderback to summary
public XppReader(Reader reader)

Deprecated

As of 1.4, use XppReader(Reader, XmlPullParser) instead

XppReaderback to summary
public XppReader(Reader reader, XmlFriendlyReplacer replacer)

Deprecated

As of 1.4, use XppReader(Reader, XmlPullParser, NameCoder) instead

Since
1.2

Method Detail

appendErrorsback to summary
public void appendErrors(ErrorWriter errorWriter)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.appendErrors.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.appendErrors.

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

Parameters
errorWriter:ErrorWriter

Doc from com.thoughtworks.xstream.converters.ErrorReporter.appendErrors.

the error writer

closeback to summary
public void close()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.close.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.close.

Close the reader, if necessary.

createParserback to summary
protected XmlPullParser createParser()

Deprecated

As of 1.4, use XppReader(Reader, XmlPullParser) instead

To use another implementation of org.xmlpull.v1.XmlPullParser, override this method.

getAttributeback to summary
public String getAttribute(String name)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Get the value of an attribute of the current node.

If no such attribute exists, the method returns null.

getAttributeback to summary
public String getAttribute(int index)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Get the value of an attribute of the current node, by index.

Note, the behavior of this method is dependent on the underlying parser when calling it with a non-existing index. Typically some kind of RuntimeException is thrown.

getAttributeCountback to summary
public int getAttributeCount()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeCount.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeCount.

Number of attributes in current node.

getAttributeNameback to summary
public String getAttributeName(int index)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeName.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeName.

Name of attribute in current node.

Note, the behavior of this method is dependent on the underlying parser when calling it with a non-existing index. Typically some kind of RuntimeException is thrown.

pullElementNameback to summary
protected String pullElementName()

Implements abstract com.thoughtworks.xstream.io.xml.AbstractPullReader.pullElementName.

Doc from com.thoughtworks.xstream.io.xml.AbstractPullReader.pullElementName.

Pull the name of the current element from the stream.

pullNextEventback to summary
protected int pullNextEvent()

Implements abstract com.thoughtworks.xstream.io.xml.AbstractPullReader.pullNextEvent.

Doc from com.thoughtworks.xstream.io.xml.AbstractPullReader.pullNextEvent.

Pull the next event from the stream.

This MUST return START_NODE, END_NODE, TEXT, COMMENT, OTHER or throw com.thoughtworks.xstream.io.StreamException.

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

pullTextback to summary
protected String pullText()

Implements abstract com.thoughtworks.xstream.io.xml.AbstractPullReader.pullText.

Doc from com.thoughtworks.xstream.io.xml.AbstractPullReader.pullText.

Pull the contents of the current text node from the stream.