Class 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
    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

      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 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​(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 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​(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)  
      • Methods inherited from class org.xml.sax.helpers.DefaultHandler

        error, fatalError, notationDecl, skippedEntity, unparsedEntityDecl, warning
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReportHandler

        public ReportHandler()
    • Method Detail

      • setErrorHandler

        public void setErrorHandler​(org.xml.sax.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:
        org.xml.sax.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
      • 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
      • getDocumentLocator

        public org.xml.sax.Locator getDocumentLocator()
      • setDocumentLocator

        public void setDocumentLocator​(org.xml.sax.Locator loc)
        Specified by:
        setDocumentLocator in interface org.xml.sax.ContentHandler
        Overrides:
        setDocumentLocator in class org.xml.sax.helpers.DefaultHandler
      • startDocument

        public void startDocument()
        Specified by:
        startDocument in interface org.xml.sax.ContentHandler
        Overrides:
        startDocument in class org.xml.sax.helpers.DefaultHandler
      • endDocument

        public void endDocument()
                         throws org.xml.sax.SAXException
        Specified by:
        endDocument in interface org.xml.sax.ContentHandler
        Overrides:
        endDocument in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        startPrefixMapping in class org.xml.sax.helpers.DefaultHandler
      • endPrefixMapping

        public void endPrefixMapping​(java.lang.String prefix)
        Specified by:
        endPrefixMapping in interface org.xml.sax.ContentHandler
        Overrides:
        endPrefixMapping in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        endElement in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        processingInstruction in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        characters in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        ignorableWhitespace in class org.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 interface org.xml.sax.EntityResolver
        Overrides:
        resolveEntity in class org.xml.sax.helpers.DefaultHandler
        Throws:
        org.xml.sax.SAXException