bbc.rd.tvanytime.xml
Class SAXServiceInformationHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by bbc.rd.tvanytime.xml.SAXServiceInformationHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class SAXServiceInformationHandler
extends org.xml.sax.helpers.DefaultHandler

SAXServiceInformationHandler: SAX event handler used by SAXXMLParser to parse ServiceInformationTable. Uses state machine to track current position in document. Error handling: Throws SAX XML exceptions Catches invalid TVAnytime data fields, unsets the variable and keep error message to end. Parsing profiles: Two profiles are defined for which parts of the XML are parsed. BASIC: Only parses required/mandatory elements and attributes... Service serviceID Name STANDARD: Parses all of the currently used elements and attributes... Service serviceID Name serviceURL owner

Version:
1.0
Author:
Tristan Ferne, BBC Research & Development, February 2003

Constructor Summary
SAXServiceInformationHandler()
          Constructor.
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endElement(java.lang.String uri, java.lang.String name, java.lang.String qName)
          Called during parsing when end of element found.
 void error(org.xml.sax.SAXParseException e)
           
 java.lang.String filterPrefix(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          The appropriate way to use the element (and attribute) local and qualified names is to receive the prefix mapping trough the startPrefixMapping() method of the contentHandler and process the names as described as by D.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Indicates where the parser is in the document.
 void startElement(java.lang.String uri, java.lang.String name, java.lang.String _qName, org.xml.sax.Attributes atts)
          Called during parsing when start of element found.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXServiceInformationHandler

public SAXServiceInformationHandler()
Constructor.

Method Detail

startElement

public void startElement(java.lang.String uri,
                         java.lang.String name,
                         java.lang.String _qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Called during parsing when start of element found. Implements state machine.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String name,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Called during parsing when end of element found.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXParseException
Specified by:
error in interface org.xml.sax.ErrorHandler
Overrides:
error in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXParseException

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Indicates where the parser is in the document.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Overrides:
setDocumentLocator in class org.xml.sax.helpers.DefaultHandler

filterPrefix

public java.lang.String filterPrefix(java.lang.String uri,
                                     java.lang.String localName,
                                     java.lang.String qName)
The appropriate way to use the element (and attribute) local and qualified names is to receive the prefix mapping trough the startPrefixMapping() method of the contentHandler and process the names as described as by D. Megginson: " Code using element names would normally match first for a null URI, and if it's null then use qName otherwise use localName.".

Parameters:
uri - URI for namespace
localName - Element local name
qName - Element qualified name
Returns:
Name to use