Package net.sf.jasperreports.engine.xml
Class BaseSaxParserFactory
- java.lang.Object
-
- net.sf.jasperreports.engine.xml.BaseSaxParserFactory
-
- All Implemented Interfaces:
JRSaxParserFactory
- Direct Known Subclasses:
JRReportSaxParserFactory,PrintSaxParserFactory,TemplateSaxParserFactory
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.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXCEPTION_MESSAGE_KEY_INCOMPATIBLE_CLASSstatic StringEXCEPTION_MESSAGE_KEY_PARSER_CREATION_ERRORstatic StringEXCEPTION_MESSAGE_KEY_RESOURCE_NOT_FOUNDprotected JasperReportsContextjasperReportsContextprotected static StringPACKAGE_PREFIX_SUN_XERCESprotected static StringPACKAGE_PREFIX_XERCESprotected static StringPOOL_CLASS_SUN_XERCESprotected static StringPOOL_CLASS_XERCESstatic StringPROPERTY_CACHE_SCHEMASA 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 StringXERCES_PARSER_PROPERTY_GRAMMAR_POOL-
Fields inherited from interface net.sf.jasperreports.engine.xml.JRSaxParserFactory
PROPERTY_PRINT_PARSER_FACTORY, PROPERTY_REPORT_PARSER_FACTORY, PROPERTY_TEMPLATE_PARSER_FACTORY
-
-
Constructor Summary
Constructors Constructor Description BaseSaxParserFactory(JasperReportsContext jasperReportsContext)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidconfigureParser(SAXParser parser)SAXParsercreateParser()Creates a SAX parser.protected SAXParserFactorycreateSAXParserFactory()protected voidenableSchemaCaching(SAXParser parser)static JRSaxParserFactorygetFactory(JasperReportsContext jasperReportsContext, String className)protected abstract ThreadLocal<org.apache.commons.collections4.map.ReferenceMap<Object,Object>>getGrammarPoolCache()protected ObjectgetGrammarPoolCacheKey()protected StringgetResourceURI(String resource)protected abstract List<String>getSchemaLocations()protected abstract booleanisValidating()protected voidsetGrammarPoolProperty(SAXParser parser, String poolClassName)
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_INCOMPATIBLE_CLASS
public static final String EXCEPTION_MESSAGE_KEY_INCOMPATIBLE_CLASS
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_PARSER_CREATION_ERROR
public static final String EXCEPTION_MESSAGE_KEY_PARSER_CREATION_ERROR
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_RESOURCE_NOT_FOUND
public static final String EXCEPTION_MESSAGE_KEY_RESOURCE_NOT_FOUND
- See Also:
- Constant Field Values
-
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
-
jasperReportsContext
protected final JasperReportsContext jasperReportsContext
-
-
Constructor Detail
-
BaseSaxParserFactory
public BaseSaxParserFactory(JasperReportsContext jasperReportsContext)
-
-
Method Detail
-
createParser
public SAXParser createParser()
Description copied from interface:JRSaxParserFactoryCreates a SAX parser.- Specified by:
createParserin interfaceJRSaxParserFactory- Returns:
- the created parser
-
createSAXParserFactory
protected SAXParserFactory createSAXParserFactory() throws ParserConfigurationException, SAXException
-
isValidating
protected abstract boolean isValidating()
-
configureParser
protected void configureParser(SAXParser parser) throws SAXException
- Throws:
SAXException
-
enableSchemaCaching
protected void enableSchemaCaching(SAXParser parser)
-
getGrammarPoolCache
protected abstract ThreadLocal<org.apache.commons.collections4.map.ReferenceMap<Object,Object>> getGrammarPoolCache()
-
setGrammarPoolProperty
protected void setGrammarPoolProperty(SAXParser parser, String poolClassName)
-
getGrammarPoolCacheKey
protected Object getGrammarPoolCacheKey()
-
getFactory
public static JRSaxParserFactory getFactory(JasperReportsContext jasperReportsContext, String className)
-
-