com.google.gdata.wireformats.input
Class XmlInputParser<T>
java.lang.Object
com.google.gdata.wireformats.input.AbstractParser<T>
com.google.gdata.wireformats.input.CharacterParser<T>
com.google.gdata.wireformats.input.XmlInputParser<T>
- All Implemented Interfaces:
- InputParser<T>
- Direct Known Subclasses:
- AtomDataParser, AtomServiceDataParser
public abstract class XmlInputParser<T>
- extends CharacterParser<T>
The XmlInputParser class is an abstract base class supporting the creation
of new InputParser
implementations that parse XML content. Concrete
class will need to implement the both the
CharacterParser.parse(Reader, InputProperties, Class)
and
parse(XmlEventSource, InputProperties, Class)
methods to handle
parsing from the two possible source types.
Constructor Summary |
XmlInputParser(AltFormat altFormat,
java.lang.Class<T> resultClass)
Creates a new XmlInputParser instance for the provided representation and
result type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XmlInputParser
public XmlInputParser(AltFormat altFormat,
java.lang.Class<T> resultClass)
- Creates a new XmlInputParser instance for the provided representation and
result type.
- Parameters:
altFormat
- parsed representation.resultClass
- parser output result type.
parse
public <R extends T> R parse(ParseSource parseSource,
InputProperties inProps,
java.lang.Class<R> targetClass)
throws java.io.IOException,
ServiceException
- Description copied from class:
CharacterParser
- The parse method will use the character encoding found in the output
properties instance to construct an appropriate
Reader
and then
delegate to the CharacterParser.parse(Reader, InputProperties, Class)
method
to perform the parsing.
- Specified by:
parse
in interface InputParser<T>
- Overrides:
parse
in class CharacterParser<T>
- Parameters:
parseSource
- providing the source of the datainProps
- properties describing the input datatargetClass
- specific type of result expected from the parse
- Throws:
java.io.IOException
ServiceException
parse
protected abstract <R extends T> R parse(XmlEventSource eventSource,
InputProperties inProps,
java.lang.Class<R> targetClass)
throws java.io.IOException,
ServiceException
- The parse method should be implemented by subclasses and should parse
input data from the provided
XmlEventSource
instance.
- Type Parameters:
R
- result type- Parameters:
eventSource
- event source.inProps
- input properties.targetClass
- result type.
- Returns:
- instance of result type.
- Throws:
java.io.IOException
- error reading data from event source.
ServiceException
- parsing error.