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

public Class StaxReader

extends AbstractPullReader
Class Inheritance
Imports
com.thoughtworks.xstream.converters.ErrorWriter, com.thoughtworks.xstream.io.StreamException, com.thoughtworks.xstream.io.naming.NameCoder, javax.xml.namespace.QName, javax.xml.stream.XMLStreamConstants, .XMLStreamException, .XMLStreamReader

Deprecated

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

A reader using the StAX API.
Author
James Strachan
Version
$Revision$

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
public
StaxReader(QNameMap qnameMap, XMLStreamReader in, NameCoder replacer)

public

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

inback to summary
private final XMLStreamReader in
qnameMapback to summary
private final QNameMap qnameMap

Constructor Detail

StaxReaderback to summary
public StaxReader(QNameMap qnameMap, XMLStreamReader in)
StaxReaderback to summary
public StaxReader(QNameMap qnameMap, XMLStreamReader in, NameCoder replacer)
Since
1.4
StaxReaderback to summary
public StaxReader(QNameMap qnameMap, XMLStreamReader in, XmlFriendlyReplacer replacer)
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.

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.