org.faceless.report
Class ReportHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.faceless.report.ReportHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class ReportHandler
extends DefaultHandler

A ContentHandler which will parse the Report Generator XML and creeate a PDF as a result. Normally this is created by the ReportParser, 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
ReportHandler()
           
 
Method Summary
 void characters(char[] c, int start, int len)
           
 void endDocument()
           
 void endElement(String nspace, String name, String qname)
           
 void endPrefixMapping(String prefix)
           
 boolean getFlag(int key)
          Get the status of a flag, as set by setFlag(int, boolean)
 PDF getPDF()
          Get the PDF that has been generated by the last XML input parsed by this ReportHandler
 void ignorableWhitespace(char[] c, int start, int len)
           
 void processingInstruction(String target, String data)
           
 InputSource resolveEntity(String publicid, String systemid)
           
 void setDocumentLocator(Locator loc)
           
 void setErrorHandler(ErrorHandler handler)
          Set the ErrorHandler 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 the MetaHandler to handle any unknown Meta Tags encountered during the parse.
 void startDocument()
           
 void startElement(String nspace, String name, String qname, Attributes atts)
           
 void startPrefixMapping(String prefix, String uri)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, notationDecl, skippedEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportHandler

public ReportHandler()
Method Detail

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
Set the ErrorHandler to handle any errors or warning thrown by the parsing process. The default handler prints any exceptions and warnings to System.err and throws a SAXException, ending the parsing process.

Parameters:
errorhandler - the ErrorHandler to use to catch errors
Throws:
SAXException

setMetaHandler

public void setMetaHandler(MetaHandler handler)
Set the MetaHandler to handle any unknown Meta Tags encountered during the parse. The default handler ignores these tags.

Parameters:
metahandler - the MetaHandler 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 are #WARNING_UNKNOWN_TAG, #WARNING_UNKNOWN_ATTRIBUTE, #WARNING_MISPLACED_TEXT and #DEBUG_TO_STDOUT

Parameters:
flag - the name of the flag to set
value - the value to set the flag to

getFlag

public boolean getFlag(int key)
Get the status of a flag, as set by setFlag(int, boolean)

Parameters:
flag - the name of the flag
Returns:
the value of the flag

setDocumentLocator

public void setDocumentLocator(Locator loc)
Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class DefaultHandler

startDocument

public void startDocument()
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class DefaultHandler

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler
Throws:
SAXException

startElement

public void startElement(String nspace,
                         String name,
                         String qname,
                         Attributes atts)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class DefaultHandler

endPrefixMapping

public void endPrefixMapping(String prefix)
Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class DefaultHandler

endElement

public void endElement(String nspace,
                       String name,
                       String qname)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in class DefaultHandler
Throws:
SAXException

characters

public void characters(char[] c,
                       int start,
                       int len)
                throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] c,
                                int start,
                                int len)
                         throws SAXException
Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in class DefaultHandler
Throws:
SAXException

resolveEntity

public InputSource resolveEntity(String publicid,
                                 String systemid)
                          throws SAXException
Specified by:
resolveEntity in interface EntityResolver
Overrides:
resolveEntity in class DefaultHandler
Throws:
SAXException


Copyright © 2001-2012 Big Faceless Organization