Package org.faceless.report
Class ReportHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.faceless.report.ReportHandler
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class ReportHandler extends org.xml.sax.helpers.DefaultHandler
AContentHandler
which will parse the Report Generator XML and creeate a PDF as a result. Normally this is created by theReportParser
, but for use as the final stage in an XSL transformation it's possibile to instantiate and use this class directly. An example of how to use this would be:ReportHandler handler = new ReportHandler(); SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); parser.parse(inputsource, handler); PDF pdf = handler.getPDF();
- Since:
- 1.1.51
-
-
Constructor Summary
Constructors Constructor Description ReportHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] c, int start, int len)
void
endDocument()
void
endElement(java.lang.String nspace, java.lang.String name, java.lang.String qname)
void
endPrefixMapping(java.lang.String prefix)
org.xml.sax.Locator
getDocumentLocator()
boolean
getFlag(int key)
Get the status of a flag, as set bysetFlag(int, boolean)
PDF
getPDF()
Get the PDF that has been generated by the last XML input parsed by this ReportHandlervoid
ignorableWhitespace(char[] c, int start, int len)
void
processingInstruction(java.lang.String target, java.lang.String data)
org.xml.sax.InputSource
resolveEntity(java.lang.String publicid, java.lang.String systemid)
void
setDocumentLocator(org.xml.sax.Locator loc)
void
setErrorHandler(org.xml.sax.ErrorHandler handler)
Set theErrorHandler
to handle any errors or warning thrown by the parsing process.void
setFlag(int key, boolean value)
Set or clear a flag to change the parsing process.void
setMetaHandler(MetaHandler handler)
Set theMetaHandler
to handle any unknown Meta Tags encountered during the parse.void
startDocument()
void
startElement(java.lang.String nspace, java.lang.String name, java.lang.String qname, org.xml.sax.Attributes atts)
void
startPrefixMapping(java.lang.String prefix, java.lang.String uri)
-
-
-
Method Detail
-
setErrorHandler
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
Set theErrorHandler
to handle any errors or warning thrown by the parsing process. The default handler prints any exceptions and warnings toSystem.err
and throws a SAXException, ending the parsing process.- Parameters:
errorhandler
- theErrorHandler
to use to catch errors- Throws:
org.xml.sax.SAXException
-
setMetaHandler
public void setMetaHandler(MetaHandler handler)
Set theMetaHandler
to handle any unknown Meta Tags encountered during the parse. The default handler ignores these tags.- Parameters:
metahandler
- theMetaHandler
to use to process any unrecognised meta tags
-
getPDF
public PDF getPDF()
Get the PDF that has been generated by the last XML input parsed by this ReportHandler
-
setFlag
public void setFlag(int key, boolean value)
Set or clear a flag to change the parsing process. Current valid flags areReportParser.WARNING_UNKNOWN_TAG
,ReportParser.WARNING_UNKNOWN_ATTRIBUTE
,ReportParser.WARNING_MISPLACED_TEXT
,ReportParser.DEBUG_TO_STDOUT
andReportParser.ENABLE_EXTERNAL_ENTITIES
- Parameters:
flag
- the name of the flag to setvalue
- the value to set the flag to
-
getFlag
public boolean getFlag(int key)
Get the status of a flag, as set bysetFlag(int, boolean)
- Parameters:
flag
- the name of the flag- Returns:
- the value of the flag
-
getDocumentLocator
public org.xml.sax.Locator getDocumentLocator()
-
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator loc)
- Specified by:
setDocumentLocator
in interfaceorg.xml.sax.ContentHandler
- Overrides:
setDocumentLocator
in classorg.xml.sax.helpers.DefaultHandler
-
startDocument
public void startDocument()
- Specified by:
startDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startDocument
in classorg.xml.sax.helpers.DefaultHandler
-
endDocument
public void endDocument() throws org.xml.sax.SAXException
- Specified by:
endDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endDocument
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String nspace, java.lang.String name, java.lang.String qname, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
- Specified by:
startPrefixMapping
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startPrefixMapping
in classorg.xml.sax.helpers.DefaultHandler
-
endPrefixMapping
public void endPrefixMapping(java.lang.String prefix)
- Specified by:
endPrefixMapping
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endPrefixMapping
in classorg.xml.sax.helpers.DefaultHandler
-
endElement
public void endElement(java.lang.String nspace, java.lang.String name, java.lang.String qname) throws org.xml.sax.SAXException
- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
processingInstruction
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
- Specified by:
processingInstruction
in interfaceorg.xml.sax.ContentHandler
- Overrides:
processingInstruction
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
characters
public void characters(char[] c, int start, int len) throws org.xml.sax.SAXException
- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
ignorableWhitespace
public void ignorableWhitespace(char[] c, int start, int len) throws org.xml.sax.SAXException
- Specified by:
ignorableWhitespace
in interfaceorg.xml.sax.ContentHandler
- Overrides:
ignorableWhitespace
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
resolveEntity
public org.xml.sax.InputSource resolveEntity(java.lang.String publicid, java.lang.String systemid) throws org.xml.sax.SAXException
- Specified by:
resolveEntity
in interfaceorg.xml.sax.EntityResolver
- Overrides:
resolveEntity
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
-