net.sf.jasperreports.engine.xml
Class BaseSaxParserFactory

java.lang.Object
  extended by net.sf.jasperreports.engine.xml.BaseSaxParserFactory
All Implemented Interfaces:
JRSaxParserFactory
Direct Known Subclasses:
JRReportSaxParserFactory, PrintSaxParserFactory

public abstract class BaseSaxParserFactory
extends Object
implements JRSaxParserFactory

Base SAX parser factory.

This factory creates a parser via the default SAX parser factory (javax.xml.parsers.SAXParserFactory.newInstance()).

To improve performance, XML schemas can be cached when using a Xerces SAX parser. See PROPERTY_CACHE_SCHEMAS.

Version:
$Id: BaseSaxParserFactory.java 5088 2012-03-15 11:55:32Z teodord $
Author:
Lucian Chirita (lucianc@users.sourceforge.net)

Field Summary
protected static String PACKAGE_PREFIX_SUN_XERCES
           
protected static String PACKAGE_PREFIX_XERCES
           
protected static String POOL_CLASS_SUN_XERCES
           
protected static String POOL_CLASS_XERCES
           
static String PROPERTY_CACHE_SCHEMAS
          A property that determines whether XML schemas/grammars are to be cached so that they are not read/initialized each time a report is compiled.
protected static String XERCES_PARSER_PROPERTY_GRAMMAR_POOL
           
 
Fields inherited from interface net.sf.jasperreports.engine.xml.JRSaxParserFactory
PROPERTY_PRINT_PARSER_FACTORY, PROPERTY_REPORT_PARSER_FACTORY
 
Constructor Summary
BaseSaxParserFactory()
           
 
Method Summary
protected  void configureParser(SAXParser parser)
           
 SAXParser createParser()
          Creates a SAX parser.
protected  SAXParserFactory createSAXParserFactory()
           
protected  void enableSchemaCaching(SAXParser parser)
           
protected  Object getGrammarPoolCacheKey()
           
protected  String getResourceURI(String resource)
           
protected abstract  List<String> getSchemaLocations()
           
protected abstract  boolean isValidating()
           
protected  void setGrammarPoolProperty(SAXParser parser, String poolClassName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_CACHE_SCHEMAS

public static final String PROPERTY_CACHE_SCHEMAS
A property that determines whether XML schemas/grammars are to be cached so that they are not read/initialized each time a report is compiled.

Currently, setting this property is only effective when a Xerces XML parser is used (either a stock one from Apache or one embedded into a SUN JDK).

See Also:
Constant Field Values

PACKAGE_PREFIX_XERCES

protected static final String PACKAGE_PREFIX_XERCES
See Also:
Constant Field Values

POOL_CLASS_XERCES

protected static final String POOL_CLASS_XERCES
See Also:
Constant Field Values

PACKAGE_PREFIX_SUN_XERCES

protected static final String PACKAGE_PREFIX_SUN_XERCES
See Also:
Constant Field Values

POOL_CLASS_SUN_XERCES

protected static final String POOL_CLASS_SUN_XERCES
See Also:
Constant Field Values

XERCES_PARSER_PROPERTY_GRAMMAR_POOL

protected static final String XERCES_PARSER_PROPERTY_GRAMMAR_POOL
See Also:
Constant Field Values
Constructor Detail

BaseSaxParserFactory

public BaseSaxParserFactory()
Method Detail

createParser

public SAXParser createParser()
Description copied from interface: JRSaxParserFactory
Creates a SAX parser.

Specified by:
createParser in interface JRSaxParserFactory
Returns:
the created parser

createSAXParserFactory

protected SAXParserFactory createSAXParserFactory()
                                           throws ParserConfigurationException,
                                                  SAXException
Throws:
ParserConfigurationException
SAXException

isValidating

protected abstract boolean isValidating()

configureParser

protected void configureParser(SAXParser parser)
                        throws SAXException
Throws:
SAXException

getSchemaLocations

protected abstract List<String> getSchemaLocations()

getResourceURI

protected String getResourceURI(String resource)

enableSchemaCaching

protected void enableSchemaCaching(SAXParser parser)

setGrammarPoolProperty

protected void setGrammarPoolProperty(SAXParser parser,
                                      String poolClassName)

getGrammarPoolCacheKey

protected Object getGrammarPoolCacheKey()


Copyright © 2012. All Rights Reserved.