net.sf.xtvdclient.xtvd.parser
Class WriterParser

java.lang.Object
  extended by net.sf.xtvdclient.xtvd.parser.AbstractParser
      extended by net.sf.xtvdclient.xtvd.parser.WriterParser
All Implemented Interfaces:
Parser

public class WriterParser
extends AbstractParser

A parser implementation that is used to parse the incoming XML stream, and then write the parsed data back to an Writer. This parser is most useful for extracting the XTVD document from the SOAP message and storing to a file.


Field Summary
 
Fields inherited from class net.sf.xtvdclient.xtvd.parser.AbstractParser
log, reader, sdf
 
Fields inherited from interface net.sf.xtvdclient.xtvd.parser.Parser
END_OF_LINE
 
Constructor Summary
protected WriterParser(java.io.Reader in, java.io.Writer out)
          Create a new instance of the parser that reads the data from the specified Reader.
 
Method Summary
protected  void parseGenres()
          Parse the genres top-level element from the AbstractParser.reader and write the parsed data to the writer.
protected  void parseLineups()
          Parse the lineups top-level element from the AbstractParser.reader and write the parsed data to the writer.
protected  void parseProductionCrew()
          Parse the productionCrew top-level element from the AbstractParser.reader and write the parsed data to the writer.
protected  void parsePrograms()
          Parse the programs top-level element from the AbstractParser.reader and write the parsed data to the writer.
protected  void parseRootElement()
          Parse an root xtvd record from the AbstractParser.reader, and write the parsed data to the writer.
protected  void parseSchedules()
          Parse the schedules top-level element from the AbstractParser.reader and write the parsed data to the writer.
protected  void parseStations()
          Parse an individual station record from the AbstractParser.reader, and write the parsed data to the writer.
 void parseXTVD()
          Read the SOAP response from the AbstractParser.reader, parse the XTVD document from the response and write the document to the writer.
 
Methods inherited from class net.sf.xtvdclient.xtvd.parser.AbstractParser
getCrew, getCrew, getGenre, getGenre, getLineup, getLineup, getLog, getMap, getMap, getMember, getMember, getMessages, getPart, getPart, getProgram, getProgram, getProgramGenre, getProgramGenre, getSchedule, getSchedule, getStation, getStation, setLog, toStartTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriterParser

protected WriterParser(java.io.Reader in,
                       java.io.Writer out)
                throws DataDirectException
Create a new instance of the parser that reads the data from the specified Reader.

Parameters:
Reader - in - The Reader from which the XML data is to be parsed. Make sure that the reader object has the character encoding properly set to UTF-8.
Writer - out - The writer to which the parsed XTVD XML is to be written. Make sure that the writer object has the character encoding properly set to UTF-8.
Throws:
DataDirectException - - If errors are encountered while initialising the parser or reading the data.
Method Detail

parseXTVD

public void parseXTVD()
               throws DataDirectException
Read the SOAP response from the AbstractParser.reader, parse the XTVD document from the response and write the document to the writer.

Specified by:
parseXTVD in interface Parser
Specified by:
parseXTVD in class AbstractParser
Throws:
DataDirectException - - If errors are encountered while parsing the XML data stream or while writing to the writer.
See Also:
AbstractParser.getMessages(), parseRootElement(), parseStations(), parseLineups(), parseSchedules(), parsePrograms(), parseProductionCrew(), parseGenres()

parseRootElement

protected void parseRootElement()
                         throws DataDirectException
Parse an root xtvd record from the AbstractParser.reader, and write the parsed data to the writer. Also add the XML declaration at the top of the output.

Throws:
DataDirectException - - If errors are encountered while reading or writing the XML data.

parseStations

protected void parseStations()
                      throws DataDirectException
Parse an individual station record from the AbstractParser.reader, and write the parsed data to the writer.

Throws:
DataDirectException - - If errors are encountered while reading or writing the XML data.
See Also:
AbstractParser.getStation(Station)

parseLineups

protected void parseLineups()
                     throws DataDirectException
Parse the lineups top-level element from the AbstractParser.reader and write the parsed data to the writer.

Throws:
DataDirectException - - If errors are encountered while reading or writing the XML data.
See Also:
#getLineup(net.sf.xtvdclient.xtvd.Lineup)

parseSchedules

protected void parseSchedules()
                       throws DataDirectException
Parse the schedules top-level element from the AbstractParser.reader and write the parsed data to the writer.

Throws:
DataDirectException - - If errors are encountered while reading or writing the XML data.
See Also:
AbstractParser.getSchedule(net.sf.xtvdclient.xtvd.datatypes.Schedule)

parsePrograms

protected void parsePrograms()
                      throws DataDirectException
Parse the programs top-level element from the AbstractParser.reader and write the parsed data to the writer.

Throws:
DataDirectException - - If errors are encountered while reading or writing the XML data.
See Also:
AbstractParser.getProgram(net.sf.xtvdclient.xtvd.datatypes.Program)

parseProductionCrew

protected void parseProductionCrew()
                            throws DataDirectException
Parse the productionCrew top-level element from the AbstractParser.reader and write the parsed data to the writer.

Throws:
DataDirectException - - If errors are encountered while reading or writing the XML data.
See Also:
#getCrew(net.sf.xtvdclient.xtvd.Crew)

parseGenres

protected void parseGenres()
                    throws DataDirectException
Parse the genres top-level element from the AbstractParser.reader and write the parsed data to the writer.

Throws:
DataDirectException - - If errors are encountered while reading or writing the XML data.
See Also:
AbstractParser.getProgramGenre(ProgramGenre)