Class DigesterLoader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BinderClassLoaderThe class loader to use for instantiating application objects.private EntityResolverThe EntityResolver used by the SAX parser.The URLs of entityValidator that have been registered, keyed by the public identifier that corresponds.private ErrorHandlerThe application-supplied error handler that is notified when parsing warnings, errors, or fatal errors occur.private ExecutorServiceThe executor service to run asynchronous parse method.private final SAXParserFactoryThe SAXParserFactory to create new defaultDigesterinstances.private static final StringThe default head when reporting an errors list.private LocatorThe Locator associated with our parser.private final DefaultRulesBinderThe concreteRulesBinderimplementation.private final Iterable<RulesModule> private StackActionObject which will receive callbacks for every pop/push action on the default stack or named stacks.private SubstitutorAn optional class that substitutes values in attributes and body text. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateDigesterLoader(Iterable<RulesModule> rulesModules) Creates a newDigesterLoaderinstance given a collection ofRulesModuleinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd rules to an already created Digester instance, analyzing the digester annotations in the target class.Creates a newRuleSetinstance based on the current configuration.Gets the document locator associated with our parser.Return the error handler for this Digester.Returns the executor service used to run asynchronous parse method.Return the set of DTD URL registrations, keyed by public identifier.booleanReturn the "namespace aware" flag for parsers we create.booleanReturn the validating parser flag.booleanReturn the XInclude-aware flag for parsers we create;newDigester(SAXParser parser) newDigester(SAXParser parser, Rules rules) newDigester(Rules rules) newDigester(XMLReader reader) newDigester(XMLReader reader, Rules rules) static DigesterLoadernewLoader(Iterable<RulesModule> rulesModules) Creates a newDigesterLoaderinstance given a collection ofRulesModuleinstance.static DigesterLoadernewLoader(RulesModule... rulesModules) Creates a newDigesterLoaderinstance given one or moreRulesModuleinstance.Convenience method that registers the string version of an entity URL instead of a URL version.Register the specified DTD URL for the specified public identifier.setClassLoader(ClassLoader classLoader) Set the class loader to be used for instantiating application objects when required.setDocumentLocator(Locator locator) Sets the document locator associated with our parser.setEntityResolver(EntityResolver entityResolver) Set theEntityResolverused by SAX when resolving public id and system id.setErrorHandler(ErrorHandler errorHandler) Set the error handler for this Digester.setExecutorService(ExecutorService executorService) Sets the executor service to run asynchronous parse method.setNamespaceAware(boolean namespaceAware) Set the "namespace aware" flag for parsers we create.Set the XML Schema to be used when parsing.setStackAction(StackAction stackAction) Sets the Object which will receive callbacks for every pop/push action on the default stack or named stacks.setSubstitutor(Substitutor substitutor) Sets theSubstitutorto be used to convert attributes and body text.setUseContextClassLoader(boolean useContextClassLoader) Determine whether to use the Context ClassLoader (the one found by callingThread.currentThread().getContextClassLoader()) to resolve/load classes that are defined in various rules.setValidating(boolean validating) Set the validating parser flag.setXIncludeAware(boolean xIncludeAware) Set the XInclude-aware flag for parsers we create.
-
Field Details
-
HEADING
-
rulesBinder
The concreteRulesBinderimplementation. -
entityValidator
-
factory
The SAXParserFactory to create new defaultDigesterinstances. -
rulesModules
-
classLoader
The class loader to use for instantiating application objects. If not specified, the context class loader, or the class loader used to load Digester itself, is used, based on the value of theuseContextClassLoadervariable. -
substitutor
An optional class that substitutes values in attributes and body text. This may be null and so a null check is always required before use. -
entityResolver
The EntityResolver used by the SAX parser. By default it use this class -
stackAction
Object which will receive callbacks for every pop/push action on the default stack or named stacks. -
executorService
The executor service to run asynchronous parse method.- Since:
- 3.1
-
errorHandler
The application-supplied error handler that is notified when parsing warnings, errors, or fatal errors occur.- Since:
- 3.2
-
locator
-
-
Constructor Details
-
DigesterLoader
Creates a newDigesterLoaderinstance given a collection ofRulesModuleinstance.- Parameters:
rulesModules- The modules containing theRulebinding
-
-
Method Details
-
newLoader
Creates a newDigesterLoaderinstance given one or moreRulesModuleinstance.- Parameters:
rulesModules- The modules containing theRulebinding- Returns:
- A new
DigesterLoaderinstance
-
newLoader
Creates a newDigesterLoaderinstance given a collection ofRulesModuleinstance.- Parameters:
rulesModules- The modules containing theRulebinding- Returns:
- A new
DigesterLoaderinstance
-
setUseContextClassLoader
Determine whether to use the Context ClassLoader (the one found by callingThread.currentThread().getContextClassLoader()) to resolve/load classes that are defined in various rules. If not using Context ClassLoader, then the class-loading defaults to using the calling-class' ClassLoader.- Parameters:
useContextClassLoader- determines whether to use Context ClassLoader.- Returns:
- This loader instance, useful to chain methods.
-
setClassLoader
Set the class loader to be used for instantiating application objects when required.- Parameters:
classLoader- the class loader to be used for instantiating application objects when required.- Returns:
- This loader instance, useful to chain methods.
-
setSubstitutor
Sets theSubstitutorto be used to convert attributes and body text.- Parameters:
substitutor- the Substitutor to be used to convert attributes and body text or null if not substitution of these values is to be performed.- Returns:
- This loader instance, useful to chain methods.
-
setNamespaceAware
Set the "namespace aware" flag for parsers we create.- Parameters:
namespaceAware- The new "namespace aware" flag- Returns:
- This loader instance, useful to chain methods.
-
isNamespaceAware
public boolean isNamespaceAware()Return the "namespace aware" flag for parsers we create.- Returns:
- true, if the "namespace aware" flag for parsers we create, false otherwise.
-
setXIncludeAware
Set the XInclude-aware flag for parsers we create. This additionally requires namespace-awareness.- Parameters:
xIncludeAware- The new XInclude-aware flag- Returns:
- This loader instance, useful to chain methods.
- See Also:
-
isXIncludeAware
public boolean isXIncludeAware()Return the XInclude-aware flag for parsers we create;- Returns:
- true, if the XInclude-aware flag for parsers we create is set, false otherwise
-
setValidating
Set the validating parser flag.- Parameters:
validating- The new validating parser flag.- Returns:
- This loader instance, useful to chain methods.
-
isValidating
public boolean isValidating()Return the validating parser flag.- Returns:
- true, if the validating parser flag is set, false otherwise
-
setSchema
Set the XML Schema to be used when parsing.- Parameters:
schema- TheSchemainstance to use.- Returns:
- This loader instance, useful to chain methods.
-
register
Register the specified DTD URL for the specified public identifier. This must be called before the first call to
parse().Digestercontains an internalEntityResolverimplementation. This mapsPUBLICID's to URLs (from which the resource will be loaded). A common use case for this method is to register local URLs (possibly computed at runtime by a classloader) for DTDs. This allows the performance advantage of using a local version without having to ensure everySYSTEMURI on every processed xml document is local. This implementation provides only basic functionality. If more sophisticated features are required, usingsetEntityResolver(EntityResolver)to set a custom resolver is recommended.Note: This method will have no effect when a custom
EntityResolverhas been set. (Setting a customEntityResolveroverrides the internal implementation.)- Parameters:
publicId- Public identifier of the DTD to be resolvedentityURL- The URL to use for reading this DTD- Returns:
- This loader instance, useful to chain methods.
-
register
Convenience method that registers the string version of an entity URL instead of a URL version.
- Parameters:
publicId- Public identifier of the entity to be resolvedentityURL- The URL to use for reading this entity- Returns:
- This loader instance, useful to chain methods.
-
getRegistrations
-
setEntityResolver
Set theEntityResolverused by SAX when resolving public id and system id. This must be called before the first call toparse().- Parameters:
entityResolver- a class that implement theEntityResolverinterface.- Returns:
- This loader instance, useful to chain methods.
-
setStackAction
Sets the Object which will receive callbacks for every pop/push action on the default stack or named stacks.- Parameters:
stackAction- the Object which will receive callbacks for every pop/push action on the default stack or named stacks.- Returns:
- This loader instance, useful to chain methods.
-
getExecutorService
Returns the executor service used to run asynchronous parse method.- Returns:
- the executor service used to run asynchronous parse method
- Since:
- 3.1
-
setExecutorService
Sets the executor service to run asynchronous parse method.- Parameters:
executorService- the executor service to run asynchronous parse method- Returns:
- This loader instance, useful to chain methods.
- Since:
- 3.1
-
getErrorHandler
Return the error handler for this Digester.- Returns:
- the error handler for this Digester.
- Since:
- 3.2
-
setErrorHandler
Set the error handler for this Digester.- Parameters:
errorHandler- The new error handler- Returns:
- This loader instance, useful to chain methods.
- Since:
- 3.2
-
getDocumentLocator
Gets the document locator associated with our parser.- Returns:
- the Locator supplied by the document parser
- Since:
- 3.2
-
setDocumentLocator
Sets the document locator associated with our parser.- Parameters:
locator- the document locator associated with our parser.- Returns:
- This loader instance, useful to chain methods.
- Since:
- 3.2
-
newDigester
-
newDigester
-
newDigester
-
newDigester
-
newDigester
-
newDigester
-
addRules
Add rules to an already created Digester instance, analyzing the digester annotations in the target class.- Parameters:
digester- the Digester instance reference.
-
createRuleSet
-