- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- util.misc.AbstractXmlTvDataHandler
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public abstract class AbstractXmlTvDataHandler extends org.xml.sax.helpers.DefaultHandler
- Author:
- bananeweizen
-
-
Constructor Summary
Constructors Constructor Description AbstractXmlTvDataHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
addField(ProgramFieldType fieldType, byte[] value)
Adds a binary field to the current programprotected abstract void
addField(ProgramFieldType fieldType, int value)
adds an Integer field to the current programprotected abstract void
addField(ProgramFieldType fieldType, java.lang.String value)
adds a String field to the current programprotected abstract void
addToList(ProgramFieldType fieldType, java.lang.String value, java.lang.String separator)
Adds a text to a field that builds a comma separated value (e.g. the actor list).void
characters(char[] ch, int start, int length)
Handles the occurrence of tag text by buffering it for later analysisvoid
endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
Handles the occurrence of an end tag.protected abstract void
endProgram()
program parsing finishesprotected abstract java.lang.String
getChannelCountry()
protected java.lang.String
getChannelId()
XMLTV channel id of currently parsed programprotected boolean
isValid()
whether or not the currently parsed program is validprotected abstract void
logException(java.lang.Exception exc)
protected abstract void
logMessage(java.lang.String message)
protected abstract void
setInfoBit(int bit)
sets a bit in the info fieldvoid
startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
occurrence of a start tag
Here we only handle tags with attributes, all other tags are handled when they end.protected abstract void
startProgram(Date startDate, int startTime)
starts a new program
-
-
-
Method Detail
-
characters
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
Handles the occurrence of tag text by buffering it for later analysis- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
occurrence of a start tag
Here we only handle tags with attributes, all other tags are handled when they end.- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
startProgram
protected abstract void startProgram(Date startDate, int startTime)
starts a new program- Parameters:
startDate
- start date of the programstartTime
- time in minutes after midnight
-
endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
Handles the occurrence of an end tag.- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
getChannelCountry
protected abstract java.lang.String getChannelCountry()
-
endProgram
protected abstract void endProgram()
program parsing finishes
-
isValid
protected boolean isValid()
whether or not the currently parsed program is valid- Returns:
- true if the program is valid
-
setInfoBit
protected abstract void setInfoBit(int bit)
sets a bit in the info field- Parameters:
bit
- The bit to add
-
addField
protected abstract void addField(ProgramFieldType fieldType, byte[] value)
Adds a binary field to the current program- Parameters:
fieldType
- The field type.value
- The byte array.
-
addField
protected abstract void addField(ProgramFieldType fieldType, java.lang.String value)
adds a String field to the current program- Parameters:
fieldType
- The field type.value
- The String value.
-
addField
protected abstract void addField(ProgramFieldType fieldType, int value)
adds an Integer field to the current program- Parameters:
fieldType
- The field type.value
- The int value.
-
logMessage
protected abstract void logMessage(java.lang.String message)
-
logException
protected abstract void logException(java.lang.Exception exc)
-
getChannelId
protected final java.lang.String getChannelId()
XMLTV channel id of currently parsed program- Returns:
- channel id
-
addToList
protected abstract void addToList(ProgramFieldType fieldType, java.lang.String value, java.lang.String separator)
Adds a text to a field that builds a comma separated value (e.g. the actor list).- Parameters:
fieldType
- The type of the field to add the text to.value
- The text to add.separator
- separator to add after each new entry
-
-