com.google.gdata.wireformats.input
Class XmlInputParser<T>

java.lang.Object
  extended by com.google.gdata.wireformats.input.AbstractParser<T>
      extended by com.google.gdata.wireformats.input.CharacterParser<T>
          extended by 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.


Field Summary
 
Fields inherited from class com.google.gdata.wireformats.input.AbstractParser
altFormat, resultType
 
Constructor Summary
XmlInputParser(AltFormat altFormat, java.lang.Class<T> resultClass)
          Creates a new XmlInputParser instance for the provided representation and result type.
 
Method Summary
<R extends T>
R
parse(ParseSource parseSource, InputProperties inProps, java.lang.Class<R> targetClass)
          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.
protected abstract
<R extends T>
R
parse(XmlEventSource eventSource, InputProperties inProps, java.lang.Class<R> targetClass)
          The parse method should be implemented by subclasses and should parse input data from the provided XmlEventSource instance.
 
Methods inherited from class com.google.gdata.wireformats.input.CharacterParser
getCharset, parse
 
Methods inherited from class com.google.gdata.wireformats.input.AbstractParser
createResult, createResult, getAltFormat, getResultType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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

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 data
inProps - properties describing the input data
targetClass - 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.