|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
bbc.rd.tvanytime.xml.SAXXMLParser
public class SAXXMLParser
SAXXMLParser: Implementation of XMLParser Interface using SAX.
Uses state machine to track current position in document.
All TVAnytime objects that are parsed from files are added to one of the four
tables (ProgramInformation, ProgamLocation, GroupInformation, SegmentInformation).
Error handling:
Parsing profiles:
Two profiles are defined for which parts of the XML are parsed.
Field Summary | |
---|---|
static int |
BASIC
Basic profile for XML parsing. |
static int |
STANDARD
Standard profile for XML parsing. |
Constructor Summary | |
---|---|
SAXXMLParser()
Constructor creates SAX parser. |
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
|
void |
endDocument()
Called when parsing of document ends. |
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. |
ContentReferencingTable |
getContentReferencingTable()
Get ContentReferencingTable used by this parser. |
java.util.Vector |
getGroupInformation(ContentReference crid)
Unsupported method - always throws exception. |
GroupInformationTable |
getGroupInformationTable()
Get GroupInformationTable used by this parser. |
int |
getParseProfile()
Gets the XML parsing profile. |
java.util.Vector |
getProgramInformation(ContentReference crid)
Get program information for the specified CRID. |
ProgramInformationTable |
getProgramInformationTable()
Get ProgramInformationTable used by this parser. |
java.util.Vector |
getProgramLocation(ContentReference crid)
Resolves CRID using ProgramLocation table. |
ProgramLocationTable |
getProgramLocationTable()
Get ProgramLocationTable used by this parser. |
Result |
getResult(ContentReference crid)
Get content referencing result for the specified CRID. |
java.util.Vector |
getSegmentInformation(ContentReference crid)
Unsupported method - always throws exception. |
SegmentInformationTable |
getSegmentInformationTable()
Get SegmentInformationTable used by this parser. |
ServiceInformationTable |
getServiceInformationTable()
Get ServiceInformationTable used by this parser. |
void |
parse(java.io.File f)
Parse the content of the file specified as TVAnytime XML. |
void |
parse(org.xml.sax.InputSource is)
Parse the content of the given InputSource as TVAnytime XML. |
void |
parse(java.io.InputStream is)
Parse the content of the given InputStream as TVAnytime XML. |
void |
parse(java.lang.String uri)
Parse the content described by the given Universal Resource Identifier (URI). |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Indicates where the parser is in the document. |
void |
setParseProfile(int parseProfile)
Sets the XML parsing profile. |
void |
setValidating(boolean validating)
Sets whether the parser should validate the XML - SAXXMLParser does not support validation and will always throw an exception. |
void |
startDocument()
Called when parsing of document starts. |
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 |
---|
endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BASIC
public static final int STANDARD
Constructor Detail |
---|
public SAXXMLParser() throws TVAnytimeException
TVAnytimeException
Method Detail |
---|
public void startDocument()
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
public void endDocument()
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
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
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void endElement(java.lang.String uri, java.lang.String name, java.lang.String qName)
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
public void characters(char[] ch, int start, int length)
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXParseException
error
in interface org.xml.sax.ErrorHandler
error
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXParseException
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
setDocumentLocator
in class org.xml.sax.helpers.DefaultHandler
public void parse(org.xml.sax.InputSource is) throws java.io.IOException, TVAnytimeException, NonFatalXMLException
parse
in interface XMLParser
is
- The InputSource containing the content to be parsed.
java.io.IOException
- If any IO errors occur.
TVAnytimeException
- If the underlying parser throws an error while parsing.
NonFatalXMLException
- If the underlying parser throws a non-fatal error while parsing.public void parse(java.io.File f) throws java.io.IOException, TVAnytimeException, NonFatalXMLException
parse
in interface XMLParser
f
- File containing the TVAnytime XML.
java.io.IOException
- If any IO errors occur.
TVAnytimeException
- If the underlying parser throws an error while parsing.
NonFatalXMLException
- If the underlying parser throws a non-fatal error while parsing.public void parse(java.io.InputStream is) throws java.io.IOException, TVAnytimeException
parse
in interface XMLParser
is
- The InputStream containing the content to be parsed.
java.io.IOException
- If any IO errors occur.
TVAnytimeException
- If the underlying parser throws an error while parsing.public void parse(java.lang.String uri) throws java.io.IOException, TVAnytimeException
parse
in interface XMLParser
uri
- The location of the content to be parsed.
java.io.IOException
- If any IO errors occur.
TVAnytimeException
- If the underlying parser throws an error while parsing.public ProgramInformationTable getProgramInformationTable()
public SegmentInformationTable getSegmentInformationTable()
public GroupInformationTable getGroupInformationTable()
public ProgramLocationTable getProgramLocationTable()
public ContentReferencingTable getContentReferencingTable()
public ServiceInformationTable getServiceInformationTable()
public void setParseProfile(int parseProfile)
parseProfile
- The XML parsing profile (SAXXMLParser.BASIC or SAXXMLParser.STANDARD).public int getParseProfile()
public void setValidating(boolean validating) throws TVAnytimeException
setValidating
in interface XMLParser
validating
- Whether the parser should validate.
TVAnytimeException
- if couldn't set property.public java.util.Vector getProgramLocation(ContentReference crid) throws SearchInterfaceNotSupportedException
getProgramLocation
in interface MetadataSearch
crid
- the CRID of the ProgramLocation object to be searched for.
SearchInterfaceNotSupportedException
- If the implementation doesn't support this function.public java.util.Vector getProgramInformation(ContentReference crid) throws SearchInterfaceNotSupportedException
getProgramInformation
in interface MetadataSearch
crid
- the CRID of the ProgramInformation object to be searched for.
SearchInterfaceNotSupportedException
- If the implementation doesn't support this function.public Result getResult(ContentReference crid) throws SearchInterfaceNotSupportedException
crid
- the CRID of the ContentReferencing object to be searched for.
SearchInterfaceNotSupportedException
- If the implementation doesn't support this function.public java.util.Vector getSegmentInformation(ContentReference crid) throws SearchInterfaceNotSupportedException
getSegmentInformation
in interface MetadataSearch
crid
- the CRID of the SegmentInformation object to be searched for.
SearchInterfaceNotSupportedException
- If the implementation doesn't support this function.public java.util.Vector getGroupInformation(ContentReference crid) throws SearchInterfaceNotSupportedException
getGroupInformation
in interface MetadataSearch
crid
- the CRID of the GroupInformation object to be searched for.
SearchInterfaceNotSupportedException
- If the implementation doesn't support this function.public java.lang.String filterPrefix(java.lang.String uri, java.lang.String localName, java.lang.String qName)
uri
- URI for namespacelocalName
- Element local nameqName
- Element qualified name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |