|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.xtvdclient.xtvd.parser.AbstractParser
net.sf.xtvdclient.xtvd.parser.XtvdParser
public class XtvdParser
A parser implementation that is used to parse the
specified XML stream, and then create a Xtvd object that
represents the XML data. This is useful for creating an object
representation of the data.
Note: After profiling the application, it was found that
keeping all the objects in memory to build a complete instance of
Xtvd required 1.5M of memory for a
4M XTVD XML document.
| Field Summary | |
|---|---|
protected Xtvd |
xtvd
The instance of Xtvd that will be populated by this
parser. |
| 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 |
XtvdParser(java.io.Reader in,
Xtvd xtvd)
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, create a Map from the data, and
set the Xtvd.genres reference. |
protected void |
parseLineups()
Parse the lineups top-level element from the
AbstractParser.reader, create a Collection with the data,
and set the Xtvd.lineups reference. |
protected void |
parseProductionCrew()
Parse the productionCrew top-level element from the
AbstractParser.reader, create a Map with the data, and
set the Xtvd.productionCrew reference. |
protected void |
parsePrograms()
Parse the programs top-level element from the
AbstractParser.reader, create a Map with the data, and
set the Xtvd.programs reference. |
protected void |
parseRootElement()
Parse an root xtvd record from the
AbstractParser.reader, and populate the attribute values for the
xtvd class. |
protected void |
parseSchedules()
Parse the schedules top-level element from the
AbstractParser.reader, create a Collection with the data,
and set the Xtvd.schedules reference. |
protected void |
parseStations()
Parse an individual station record from the
AbstractParser.reader, create a Map of all the Station records, and set the corresponding Xtvd.stations
reference. |
void |
parseXTVD()
Read the xml data from the AbstractParser.reader, parse the XTVD
document and populate the xtvd class fields. |
| 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 |
| Field Detail |
|---|
protected Xtvd xtvd
Xtvd that will be populated by this
parser.
| Constructor Detail |
|---|
protected XtvdParser(java.io.Reader in,
Xtvd xtvd)
throws DataDirectException
Reader. Also initialise the xtvd
instance variable.
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.Xtvd - xtvd - The instance of Xtvd that is to be
populated. The instance variables in the passed in object
will be populated by the parser.
DataDirectException - - If errors are encountered while
initialising the parser or reading the data.| Method Detail |
|---|
public void parseXTVD()
throws DataDirectException
AbstractParser.reader, parse the XTVD
document and populate the xtvd class fields.
parseXTVD in interface ParserparseXTVD in class AbstractParserDataDirectException - - If errors are encountered while
parsing the XML data stream.parseRootElement(),
parseStations(),
#getLineup(net.sf.xtvdclient.xtvd.Lineup),
AbstractParser.getSchedule(net.sf.xtvdclient.xtvd.datatypes.Schedule),
AbstractParser.getProgram(net.sf.xtvdclient.xtvd.datatypes.Program),
#getCrew(net.sf.xtvdclient.xtvd.Crew),
AbstractParser.getProgramGenre(net.sf.xtvdclient.xtvd.datatypes.ProgramGenre)protected void parseRootElement()
xtvd record from the
AbstractParser.reader, and populate the attribute values for the
xtvd class.
protected void parseStations()
throws DataDirectException
station record from the
AbstractParser.reader, create a Map of all the Station records, and set the corresponding Xtvd.stations
reference.
DataDirectException - - If errors are encountered while
reading or writing the XML data.AbstractParser.getStation(),
Xtvd#setStations(net.sf.xtvdclient.xtvd.Map)
protected void parseLineups()
throws DataDirectException
lineups top-level element from the
AbstractParser.reader, create a Collection with the data,
and set the Xtvd.lineups reference.
DataDirectException - - If errors are encountered while
reading or writing the XML data.AbstractParser.getLineup(),
Xtvd#setLineups(net.sf.xtvdclient.xtvd.Map)
protected void parseSchedules()
throws DataDirectException
schedules top-level element from the
AbstractParser.reader, create a Collection with the data,
and set the Xtvd.schedules reference.
DataDirectException - - If errors are encountered while
reading or writing the XML data.AbstractParser.getSchedule(),
Xtvd.setSchedules(Collection)
protected void parsePrograms()
throws DataDirectException
programs top-level element from the
AbstractParser.reader, create a Map with the data, and
set the Xtvd.programs reference.
DataDirectException - - If errors are encountered while
reading or writing the XML data.AbstractParser.getProgram(),
Xtvd#setPrograms(net.sf.xtvdclient.xtvd.Map)
protected void parseProductionCrew()
throws DataDirectException
productionCrew top-level element from the
AbstractParser.reader, create a Map with the data, and
set the Xtvd.productionCrew reference.
DataDirectException - - If errors are encountered while
reading or writing the XML data.AbstractParser.getCrew(),
Xtvd#setProductionCrew(net.sf.xtvdclient.xtvd.Map)
protected void parseGenres()
throws DataDirectException
genres top-level element from the
AbstractParser.reader, create a Map from the data, and
set the Xtvd.genres reference.
DataDirectException - - If errors are encountered while
reading or writing the XML data.AbstractParser.getProgramGenre(),
Xtvd#setGenres(net.sf.xtvdclient.xtvd.Map)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||