TV-Browser 3.3.3 API

util.misc
Class AbstractXmlTvDataHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by 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
AbstractXmlTvDataHandler()
           
 
Method Summary
protected abstract  void addField(ProgramFieldType fieldType, byte[] value)
          Adds a binary field to the current program
protected abstract  void addField(ProgramFieldType fieldType, int value)
          adds an Integer field to the current program
protected abstract  void addField(ProgramFieldType fieldType, java.lang.String value)
          adds a String field to the current program
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).
 void characters(char[] ch, int start, int length)
          Handles the occurrence of tag text by buffering it for later analysis
 void 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 finishes
protected abstract  java.lang.String getChannelCountry()
           
protected  java.lang.String getChannelId()
          XMLTV channel id of currently parsed program
protected  boolean isValid()
          whether or not the currently parsed program is valid
protected 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 field
 void 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
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractXmlTvDataHandler

public AbstractXmlTvDataHandler()
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 interface org.xml.sax.ContentHandler
Overrides:
characters in class org.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 interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.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 program
startTime - 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 interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.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


addField

protected abstract void addField(ProgramFieldType fieldType,
                                 java.lang.String value)
adds a String field to the current program

Parameters:
fieldType -
value -

addField

protected abstract void addField(ProgramFieldType fieldType,
                                 int value)
adds an Integer field to the current program

Parameters:
fieldType -
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

TV-Browser 3.3.3 API

TV-Browser 3.3.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)