Class Digester
- java.lang.Object
- 
- org.xml.sax.helpers.DefaultHandler
- 
- org.xml.sax.ext.DefaultHandler2
- 
- org.apache.tomcat.util.digester.Digester
 
 
 
- 
- All Implemented Interfaces:
- org.xml.sax.ContentHandler,- org.xml.sax.DTDHandler,- org.xml.sax.EntityResolver,- org.xml.sax.ErrorHandler,- org.xml.sax.ext.DeclHandler,- org.xml.sax.ext.EntityResolver2,- org.xml.sax.ext.LexicalHandler
 
 public class Digester extends org.xml.sax.ext.DefaultHandler2A Digester processes an XML input stream by matching a series of element nesting patterns to execute Rules that have been added prior to the start of parsing. This package was inspired by the XmlMapperclass that was part of Tomcat 3.0 and 3.1, but is organized somewhat differently.See the Digester Developer Guide for more information. IMPLEMENTATION NOTE - A single Digester instance may only be used within the context of a single thread at a time, and a call to parse()must be completed before another can be initiated even from the same thread.IMPLEMENTATION NOTE - A bug in Xerces 2.0.2 prevents the support of XML schema. You need Xerces 2.1/2.3 and up to make this class working with XML schema 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classDigester.EnvironmentPropertySourceDeprecated.UseEnvironmentPropertySourceThis will be removed in Tomcat 10 onwards.
 - 
Field SummaryFields Modifier and Type Field Description protected java.lang.StringBuilderbodyTextThe body text of the current element.protected ArrayStack<java.lang.StringBuilder>bodyTextsThe stack of body text string buffers for surrounding elements.protected java.lang.ClassLoaderclassLoaderThe class loader to use for instantiating application objects.protected booleanconfiguredHas this Digester been configured yet.protected org.xml.sax.EntityResolverentityResolverThe EntityResolver used by the SAX parser.protected java.util.HashMap<java.lang.String,java.lang.String>entityValidatorThe URLs of entityValidator that have been registered, keyed by the public identifier that corresponds.protected org.xml.sax.ErrorHandlererrorHandlerThe application-supplied error handler that is notified when parsing warnings, errors, or fatal errors occur.protected javax.xml.parsers.SAXParserFactoryfactoryThe SAXParserFactory that is created the first time we need it.protected java.util.Map<java.lang.Class<?>,java.util.List<java.lang.String>>fakeAttributesFake attributes map (attributes are often used for object creation).protected org.xml.sax.LocatorlocatorThe Locator associated with our parser.protected LoglogThe Log to which most logging calls will be made.protected java.lang.StringmatchThe current match pattern for nested element processing.protected ArrayStack<java.util.List<Rule>>matchesStack whose elements are List objects, each containing a list of Rule objects as returned from Rules.getMatch().protected booleannamespaceAwareDo we want a "namespace aware" parser.protected java.util.HashMap<java.lang.String,ArrayStack<java.lang.String>>namespacesRegistered namespaces we are currently processing.protected ArrayStack<java.lang.Object>paramsThe parameters stack being utilized by CallMethodRule and CallParamRule rules.protected javax.xml.parsers.SAXParserparserThe SAXParser we will use to parse the input stream.protected static IntrospectionUtils.PropertySource[]propertySourcesprotected java.lang.StringpublicIdThe public identifier of the DTD we are currently parsing under (if any).protected org.xml.sax.XMLReaderreaderThe XMLReader used to parse digester rules.protected java.lang.ObjectrootThe "root" element of the stack (in other words, the last object that was popped.protected RulesrulesTheRulesimplementation containing our collection ofRuleinstances and associated matching policy.protected booleanrulesValidationWarn on missing attributes and elements.protected LogsaxLogThe Log to which all SAX event related logging calls will be made.protected static StringManagersmprotected IntrospectionUtils.PropertySource[]sourceprotected ArrayStack<java.lang.Object>stackThe object stack being constructed.protected booleanuseContextClassLoaderDo we want to use the Context ClassLoader when loading classes for instantiating new objects.protected booleanvalidatingDo we want to use a validating parser.
 - 
Constructor SummaryConstructors Constructor Description Digester()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddCallMethod(java.lang.String pattern, java.lang.String methodName)Add an "call method" rule for a method which accepts no arguments.voidaddCallMethod(java.lang.String pattern, java.lang.String methodName, int paramCount)Add an "call method" rule for the specified parameters.voidaddCallParam(java.lang.String pattern, int paramIndex)Add a "call parameter" rule for the specified parameters.voidaddFactoryCreate(java.lang.String pattern, ObjectCreationFactory creationFactory, boolean ignoreCreateExceptions)Add a "factory create" rule for the specified parameters.voidaddObjectCreate(java.lang.String pattern, java.lang.String className)Add an "object create" rule for the specified parameters.voidaddObjectCreate(java.lang.String pattern, java.lang.String className, java.lang.String attributeName)Add an "object create" rule for the specified parameters.voidaddRule(java.lang.String pattern, Rule rule)Register a new Rule matching the specified pattern.voidaddRuleSet(RuleSet ruleSet)Register a set of Rule instances defined in a RuleSet.voidaddSetNext(java.lang.String pattern, java.lang.String methodName, java.lang.String paramType)Add a "set next" rule for the specified parameters.voidaddSetProperties(java.lang.String pattern)Add a "set properties" rule for the specified parameters.voidcharacters(char[] buffer, int start, int length)Process notification of character data received from the body of an XML element.voidclear()Clear the current contents of the object stack.protected voidconfigure()Provide a hook for lazy configuration of thisDigesterinstance.org.xml.sax.SAXExceptioncreateSAXException(java.lang.Exception e)Create a SAX exception which also understands about the location in the digester file where the exception occursorg.xml.sax.SAXExceptioncreateSAXException(java.lang.String message)Create a SAX exception which also understands about the location in the digester file where the exception occursorg.xml.sax.SAXExceptioncreateSAXException(java.lang.String message, java.lang.Exception e)Create a SAX exception which also understands about the location in the digester file where the exception occursvoidendDocument()Process notification of the end of the document being reached.voidendElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)Process notification of the end of an XML element being reached.voidendPrefixMapping(java.lang.String prefix)Process notification that a namespace prefix is going out of scope.voiderror(org.xml.sax.SAXParseException exception)Forward notification of a parsing error to the application supplied error handler (if any).voidfatalError(org.xml.sax.SAXParseException exception)Forward notification of a fatal parsing error to the application supplied error handler (if any).java.lang.StringfindNamespaceURI(java.lang.String prefix)Return the currently mapped namespace URI for the specified prefix, if any; otherwise returnnull.java.lang.ClassLoadergetClassLoader()Return the class loader to be used for instantiating application objects when required.intgetCount()java.lang.StringgetCurrentElementName()org.xml.sax.LocatorgetDocumentLocator()Gets the document locator associated with our parser.org.xml.sax.EntityResolvergetEntityResolver()Return the Entity Resolver used by the SAX parser.org.xml.sax.ErrorHandlergetErrorHandler()javax.xml.parsers.SAXParserFactorygetFactory()SAX parser factory method.java.util.Map<java.lang.Class<?>,java.util.List<java.lang.String>>getFakeAttributes()LoggetLogger()java.lang.StringgetMatch()booleangetNamespaceAware()javax.xml.parsers.SAXParsergetParser()java.lang.ObjectgetProperty(java.lang.String property)Return the current value of the specified property for the underlyingXMLReaderimplementation.java.lang.StringgetPublicId()java.lang.ObjectgetRoot()When the Digester is being used as a SAXContentHandler, this method allows you to access the root object that has been created after parsing.java.lang.StringgetRuleNamespaceURI()Deprecated.Unused.RulesgetRules()Return theRulesimplementation object containing our rules collection and associated matching policy.booleangetRulesValidation()LoggetSAXLogger()Gets the logger used for logging SAX-related information.booleangetUseContextClassLoader()booleangetValidating()org.xml.sax.XMLReadergetXMLReader()Return the XMLReader to be used for parsing the input document.voidignorableWhitespace(char[] buffer, int start, int len)Process notification of ignorable whitespace received from the body of an XML element.booleanisFakeAttribute(java.lang.Object object, java.lang.String name)Determine if an attribute is a fake attribute.voidnotationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)Receive notification of a notation declaration event.java.lang.Objectparse(java.io.File file)Parse the content of the specified file using this Digester.java.lang.Objectparse(java.io.InputStream input)Parse the content of the specified input stream using this Digester.java.lang.Objectparse(org.xml.sax.InputSource input)Parse the content of the specified input source using this Digester.java.lang.Objectpeek()Return the top object on the stack without removing it.java.lang.Objectpeek(int n)Return the n'th object down the stack, where 0 is the top element and [getCount()-1] is the bottom element.java.lang.ObjectpeekParams()Return the top object on the parameters stack without removing it.java.lang.Objectpop()Pop the top object off of the stack, and return it.java.lang.ObjectpopParams()Pop the top object off of the parameters stack, and return it.voidprocessingInstruction(java.lang.String target, java.lang.String data)Process notification of a processing instruction that was encountered.voidpush(java.lang.Object object)Push a new object onto the top of the object stack.voidpushParams(java.lang.Object object)Push a new object onto the top of the parameters stack.voidregister(java.lang.String publicId, java.lang.String entityURL)Register the specified DTD URL for the specified public identifier.static voidreplaceSystemProperties()voidreset()org.xml.sax.InputSourceresolveEntity(java.lang.String name, java.lang.String publicId, java.lang.String baseURI, java.lang.String systemId)voidsetClassLoader(java.lang.ClassLoader classLoader)Set the class loader to be used for instantiating application objects when required.voidsetDocumentLocator(org.xml.sax.Locator locator)Sets the document locator associated with our parser.voidsetEntityResolver(org.xml.sax.EntityResolver entityResolver)Set theEntityResolverused by SAX when resolving public id and system id.voidsetErrorHandler(org.xml.sax.ErrorHandler errorHandler)Set the error handler for this Digester.voidsetFakeAttributes(java.util.Map<java.lang.Class<?>,java.util.List<java.lang.String>> fakeAttributes)Set the fake attributes.voidsetFeature(java.lang.String feature, boolean value)Sets a flag indicating whether the requested feature is supported by the underlying implementation oforg.xml.sax.XMLReader.voidsetLogger(Log log)Set the current logger for this Digester.voidsetNamespaceAware(boolean namespaceAware)Set the "namespace aware" flag for parsers we create.static voidsetPropertySource(IntrospectionUtils.PropertySource propertySource)static voidsetPropertySource(IntrospectionUtils.PropertySource[] propertySources)voidsetPublicId(java.lang.String publicId)Set the public id of the current file being parse.voidsetRuleNamespaceURI(java.lang.String ruleNamespaceURI)Deprecated.Unused.voidsetRules(Rules rules)Set theRulesimplementation object containing our rules collection and associated matching policy.voidsetRulesValidation(boolean rulesValidation)Set the rules validation flag.voidsetSAXLogger(Log saxLog)Sets the logger used for logging SAX-related information.voidsetUseContextClassLoader(boolean use)Determine whether to use the Context ClassLoader (the one found by callingThread.currentThread().getContextClassLoader()) to resolve/load classes that are defined in various rules.voidsetValidating(boolean validating)Set the validating parser flag.voidskippedEntity(java.lang.String name)Process notification of a skipped entity.voidstartDocument()Process notification of the beginning of the document being reached.voidstartDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)voidstartElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes list)Process notification of the start of an XML element being reached.voidstartPrefixMapping(java.lang.String prefix, java.lang.String namespaceURI)Process notification that a namespace prefix is coming in to scope.voidunparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notation)Receive notification of an unparsed entity declaration event.voidwarning(org.xml.sax.SAXParseException exception)Forward notification of a parse warning to the application supplied error handler (if any).
 
- 
- 
- 
Field Detail- 
propertySourcesprotected static IntrospectionUtils.PropertySource[] propertySources 
 - 
smprotected static final StringManager sm 
 - 
sourceprotected IntrospectionUtils.PropertySource[] source 
 - 
bodyTextprotected java.lang.StringBuilder bodyText The body text of the current element.
 - 
bodyTextsprotected ArrayStack<java.lang.StringBuilder> bodyTexts The stack of body text string buffers for surrounding elements.
 - 
matchesprotected ArrayStack<java.util.List<Rule>> matches Stack whose elements are List objects, each containing a list of Rule objects as returned from Rules.getMatch(). As each xml element in the input is entered, the matching rules are pushed onto this stack. After the end tag is reached, the matches are popped again. The depth of is stack is therefore exactly the same as the current "nesting" level of the input xml.- Since:
- 1.6
 
 - 
classLoaderprotected java.lang.ClassLoader 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.
 - 
configuredprotected boolean configured Has this Digester been configured yet.
 - 
entityResolverprotected org.xml.sax.EntityResolver entityResolver The EntityResolver used by the SAX parser. By default it use this class
 - 
entityValidatorprotected java.util.HashMap<java.lang.String,java.lang.String> entityValidator The URLs of entityValidator that have been registered, keyed by the public identifier that corresponds.
 - 
errorHandlerprotected org.xml.sax.ErrorHandler errorHandler The application-supplied error handler that is notified when parsing warnings, errors, or fatal errors occur.
 - 
factoryprotected javax.xml.parsers.SAXParserFactory factory The SAXParserFactory that is created the first time we need it.
 - 
locatorprotected org.xml.sax.Locator locator The Locator associated with our parser.
 - 
matchprotected java.lang.String match The current match pattern for nested element processing.
 - 
namespaceAwareprotected boolean namespaceAware Do we want a "namespace aware" parser.
 - 
namespacesprotected java.util.HashMap<java.lang.String,ArrayStack<java.lang.String>> namespaces Registered namespaces we are currently processing. The key is the namespace prefix that was declared in the document. The value is an ArrayStack of the namespace URIs this prefix has been mapped to -- the top Stack element is the most current one. (This architecture is required because documents can declare nested uses of the same prefix for different Namespace URIs).
 - 
paramsprotected ArrayStack<java.lang.Object> params The parameters stack being utilized by CallMethodRule and CallParamRule rules.
 - 
parserprotected javax.xml.parsers.SAXParser parser The SAXParser we will use to parse the input stream.
 - 
publicIdprotected java.lang.String publicId The public identifier of the DTD we are currently parsing under (if any).
 - 
readerprotected org.xml.sax.XMLReader reader The XMLReader used to parse digester rules.
 - 
rootprotected java.lang.Object root The "root" element of the stack (in other words, the last object that was popped.
 - 
rulesprotected Rules rules TheRulesimplementation containing our collection ofRuleinstances and associated matching policy. If not established before the first rule is added, a default implementation will be provided.
 - 
stackprotected ArrayStack<java.lang.Object> stack The object stack being constructed.
 - 
useContextClassLoaderprotected boolean useContextClassLoader Do we want to use the Context ClassLoader when loading classes for instantiating new objects. Default isfalse.
 - 
validatingprotected boolean validating Do we want to use a validating parser.
 - 
rulesValidationprotected boolean rulesValidation Warn on missing attributes and elements.
 - 
fakeAttributesprotected java.util.Map<java.lang.Class<?>,java.util.List<java.lang.String>> fakeAttributes Fake attributes map (attributes are often used for object creation).
 - 
logprotected Log log The Log to which most logging calls will be made.
 - 
saxLogprotected Log saxLog The Log to which all SAX event related logging calls will be made.
 
- 
 - 
Method Detail- 
setPropertySourcepublic static void setPropertySource(IntrospectionUtils.PropertySource propertySource) 
 - 
setPropertySourcepublic static void setPropertySource(IntrospectionUtils.PropertySource[] propertySources) 
 - 
replaceSystemPropertiespublic static void replaceSystemProperties() 
 - 
findNamespaceURIpublic java.lang.String findNamespaceURI(java.lang.String prefix) Return the currently mapped namespace URI for the specified prefix, if any; otherwise returnnull. These mappings come and go dynamically as the document is parsed.- Parameters:
- prefix- Prefix to look up
- Returns:
- the namespace URI
 
 - 
getClassLoaderpublic java.lang.ClassLoader getClassLoader() Return the class loader to be used for instantiating application objects when required. This is determined based upon the following rules:- The class loader set by setClassLoader(), if any
- The thread context class loader, if it exists and the
     useContextClassLoaderproperty is set to true
- The class loader used to load the Digester class itself.
 - Returns:
- the classloader
 
- The class loader set by 
 - 
setClassLoaderpublic void setClassLoader(java.lang.ClassLoader classLoader) Set the class loader to be used for instantiating application objects when required.- Parameters:
- classLoader- The new class loader to use, or- nullto revert to the standard rules
 
 - 
getCountpublic int getCount() - Returns:
- the current depth of the element stack.
 
 - 
getCurrentElementNamepublic java.lang.String getCurrentElementName() - Returns:
- the name of the XML element that is currently being processed.
 
 - 
getErrorHandlerpublic org.xml.sax.ErrorHandler getErrorHandler() - Returns:
- the error handler for this Digester.
 
 - 
setErrorHandlerpublic void setErrorHandler(org.xml.sax.ErrorHandler errorHandler) Set the error handler for this Digester.- Parameters:
- errorHandler- The new error handler
 
 - 
getFactorypublic javax.xml.parsers.SAXParserFactory getFactory() throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException, javax.xml.parsers.ParserConfigurationExceptionSAX parser factory method.- Returns:
- the SAXParserFactory we will use, creating one if necessary.
- Throws:
- javax.xml.parsers.ParserConfigurationException- Error creating parser
- org.xml.sax.SAXNotSupportedException- Error creating parser
- org.xml.sax.SAXNotRecognizedException- Error creating parser
 
 - 
setFeaturepublic void setFeature(java.lang.String feature, boolean value) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionSets a flag indicating whether the requested feature is supported by the underlying implementation oforg.xml.sax.XMLReader. See http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description for information about the standard SAX2 feature flags. In order to be effective, this method must be called before thegetParser()method is called for the first time, either directly or indirectly.- Parameters:
- feature- Name of the feature to set the status for
- value- The new value for this feature
- Throws:
- javax.xml.parsers.ParserConfigurationException- if a parser configuration error occurs
- org.xml.sax.SAXNotRecognizedException- if the property name is not recognized
- org.xml.sax.SAXNotSupportedException- if the property name is recognized but not supported
 
 - 
getLoggerpublic Log getLogger() - Returns:
- the current Logger associated with this instance of the Digester
 
 - 
setLoggerpublic void setLogger(Log log) Set the current logger for this Digester.- Parameters:
- log- The logger that will be used
 
 - 
getSAXLoggerpublic Log getSAXLogger() Gets the logger used for logging SAX-related information. Note the output is finely grained.- Returns:
- the SAX logger
- Since:
- 1.6
 
 - 
setSAXLoggerpublic void setSAXLogger(Log saxLog) Sets the logger used for logging SAX-related information. Note the output is finely grained.- Parameters:
- saxLog- Log, not null
- Since:
- 1.6
 
 - 
getMatchpublic java.lang.String getMatch() - Returns:
- the current rule match path
 
 - 
getNamespaceAwarepublic boolean getNamespaceAware() - Returns:
- the "namespace aware" flag for parsers we create.
 
 - 
setNamespaceAwarepublic void setNamespaceAware(boolean namespaceAware) Set the "namespace aware" flag for parsers we create.- Parameters:
- namespaceAware- The new "namespace aware" flag
 
 - 
setPublicIdpublic void setPublicId(java.lang.String publicId) Set the public id of the current file being parse.- Parameters:
- publicId- the DTD/Schema public's id.
 
 - 
getPublicIdpublic java.lang.String getPublicId() - Returns:
- the public identifier of the DTD we are currently parsing under, if any.
 
 - 
getRuleNamespaceURI@Deprecated public java.lang.String getRuleNamespaceURI() Deprecated.Unused. Will be removed in Tomcat 9- Returns:
- the namespace URI that will be applied to all subsequently
 added Ruleobjects.
 
 - 
setRuleNamespaceURI@Deprecated public void setRuleNamespaceURI(java.lang.String ruleNamespaceURI) Deprecated.Unused. Will be removed in Tomcat 9Set the namespace URI that will be applied to all subsequently addedRuleobjects.- Parameters:
- ruleNamespaceURI- Namespace URI that must match on all subsequently added rules, or- nullfor matching regardless of the current namespace URI
 
 - 
getParserpublic javax.xml.parsers.SAXParser getParser() - Returns:
- the SAXParser we will use to parse the input stream.  If there
 is a problem creating the parser, return null.
 
 - 
getPropertypublic java.lang.Object getProperty(java.lang.String property) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionReturn the current value of the specified property for the underlyingXMLReaderimplementation. See http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description for information about the standard SAX2 properties.- Parameters:
- property- Property name to be retrieved
- Returns:
- the property value
- Throws:
- org.xml.sax.SAXNotRecognizedException- if the property name is not recognized
- org.xml.sax.SAXNotSupportedException- if the property name is recognized but not supported
 
 - 
getRulespublic Rules getRules() Return theRulesimplementation object containing our rules collection and associated matching policy. If none has been established, a default implementation will be created and returned.- Returns:
- the rules
 
 - 
setRulespublic void setRules(Rules rules) Set theRulesimplementation object containing our rules collection and associated matching policy.- Parameters:
- rules- New Rules implementation
 
 - 
getUseContextClassLoaderpublic boolean getUseContextClassLoader() - Returns:
- the boolean as to whether the context classloader should be used.
 
 - 
setUseContextClassLoaderpublic void setUseContextClassLoader(boolean use) 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:
- use- determines whether to use Context ClassLoader.
 
 - 
getValidatingpublic boolean getValidating() - Returns:
- the validating parser flag.
 
 - 
setValidatingpublic void setValidating(boolean validating) Set the validating parser flag. This must be called beforeparse()is called the first time.- Parameters:
- validating- The new validating parser flag.
 
 - 
getRulesValidationpublic boolean getRulesValidation() - Returns:
- the rules validation flag.
 
 - 
setRulesValidationpublic void setRulesValidation(boolean rulesValidation) Set the rules validation flag. This must be called beforeparse()is called the first time.- Parameters:
- rulesValidation- The new rules validation flag.
 
 - 
getFakeAttributespublic java.util.Map<java.lang.Class<?>,java.util.List<java.lang.String>> getFakeAttributes() - Returns:
- the fake attributes list.
 
 - 
isFakeAttributepublic boolean isFakeAttribute(java.lang.Object object, java.lang.String name)Determine if an attribute is a fake attribute.- Parameters:
- object- The object
- name- The attribute name
- Returns:
- trueif this is a fake attribute
 
 - 
setFakeAttributespublic void setFakeAttributes(java.util.Map<java.lang.Class<?>,java.util.List<java.lang.String>> fakeAttributes) Set the fake attributes.- Parameters:
- fakeAttributes- The new fake attributes.
 
 - 
getXMLReaderpublic org.xml.sax.XMLReader getXMLReader() throws org.xml.sax.SAXExceptionReturn the XMLReader to be used for parsing the input document. FIX ME: there is a bug in JAXP/XERCES that prevent the use of a parser that contains a schema with a DTD.- Returns:
- the XML reader
- Throws:
- org.xml.sax.SAXException- if no XMLReader can be instantiated
 
 - 
characterspublic void characters(char[] buffer, int start, int length) throws org.xml.sax.SAXExceptionProcess notification of character data received from the body of an XML element.- Specified by:
- charactersin interface- org.xml.sax.ContentHandler
- Overrides:
- charactersin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- buffer- The characters from the XML document
- start- Starting offset into the buffer
- length- Number of characters from the buffer
- Throws:
- org.xml.sax.SAXException- if a parsing error is to be reported
 
 - 
endDocumentpublic void endDocument() throws org.xml.sax.SAXExceptionProcess notification of the end of the document being reached.- Specified by:
- endDocumentin interface- org.xml.sax.ContentHandler
- Overrides:
- endDocumentin class- org.xml.sax.helpers.DefaultHandler
- Throws:
- org.xml.sax.SAXException- if a parsing error is to be reported
 
 - 
endElementpublic void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXExceptionProcess notification of the end of an XML element being reached.- Specified by:
- endElementin interface- org.xml.sax.ContentHandler
- Overrides:
- endElementin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- namespaceURI- - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
- localName- - The local name (without prefix), or the empty string if Namespace processing is not being performed.
- qName- - The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.
- Throws:
- org.xml.sax.SAXException- if a parsing error is to be reported
 
 - 
endPrefixMappingpublic void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXExceptionProcess notification that a namespace prefix is going out of scope.- Specified by:
- endPrefixMappingin interface- org.xml.sax.ContentHandler
- Overrides:
- endPrefixMappingin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- prefix- Prefix that is going out of scope
- Throws:
- org.xml.sax.SAXException- if a parsing error is to be reported
 
 - 
ignorableWhitespacepublic void ignorableWhitespace(char[] buffer, int start, int len) throws org.xml.sax.SAXExceptionProcess notification of ignorable whitespace received from the body of an XML element.- Specified by:
- ignorableWhitespacein interface- org.xml.sax.ContentHandler
- Overrides:
- ignorableWhitespacein class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- buffer- The characters from the XML document
- start- Starting offset into the buffer
- len- Number of characters from the buffer
- Throws:
- org.xml.sax.SAXException- if a parsing error is to be reported
 
 - 
processingInstructionpublic void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXExceptionProcess notification of a processing instruction that was encountered.- Specified by:
- processingInstructionin interface- org.xml.sax.ContentHandler
- Overrides:
- processingInstructionin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- target- The processing instruction target
- data- The processing instruction data (if any)
- Throws:
- org.xml.sax.SAXException- if a parsing error is to be reported
 
 - 
getDocumentLocatorpublic org.xml.sax.Locator getDocumentLocator() Gets the document locator associated with our parser.- Returns:
- the Locator supplied by the document parser
 
 - 
setDocumentLocatorpublic void setDocumentLocator(org.xml.sax.Locator locator) Sets the document locator associated with our parser.- Specified by:
- setDocumentLocatorin interface- org.xml.sax.ContentHandler
- Overrides:
- setDocumentLocatorin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- locator- The new locator
 
 - 
skippedEntitypublic void skippedEntity(java.lang.String name) throws org.xml.sax.SAXExceptionProcess notification of a skipped entity.- Specified by:
- skippedEntityin interface- org.xml.sax.ContentHandler
- Overrides:
- skippedEntityin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- name- Name of the skipped entity
- Throws:
- org.xml.sax.SAXException- if a parsing error is to be reported
 
 - 
startDocumentpublic void startDocument() throws org.xml.sax.SAXExceptionProcess notification of the beginning of the document being reached.- Specified by:
- startDocumentin interface- org.xml.sax.ContentHandler
- Overrides:
- startDocumentin class- org.xml.sax.helpers.DefaultHandler
- Throws:
- org.xml.sax.SAXException- if a parsing error is to be reported
 
 - 
startElementpublic void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes list) throws org.xml.sax.SAXExceptionProcess notification of the start of an XML element being reached.- Specified by:
- startElementin interface- org.xml.sax.ContentHandler
- Overrides:
- startElementin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- namespaceURI- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
- localName- The local name (without prefix), or the empty string if Namespace processing is not being performed.
- qName- The qualified name (with prefix), or the empty string if qualified names are not available.\
- list- The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
- Throws:
- org.xml.sax.SAXException- if a parsing error is to be reported
 
 - 
startPrefixMappingpublic void startPrefixMapping(java.lang.String prefix, java.lang.String namespaceURI) throws org.xml.sax.SAXExceptionProcess notification that a namespace prefix is coming in to scope.- Specified by:
- startPrefixMappingin interface- org.xml.sax.ContentHandler
- Overrides:
- startPrefixMappingin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- prefix- Prefix that is being declared
- namespaceURI- Corresponding namespace URI being mapped to
- Throws:
- org.xml.sax.SAXException- if a parsing error is to be reported
 
 - 
notationDeclpublic void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)Receive notification of a notation declaration event.- Specified by:
- notationDeclin interface- org.xml.sax.DTDHandler
- Overrides:
- notationDeclin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- name- The notation name
- publicId- The public identifier (if any)
- systemId- The system identifier (if any)
 
 - 
unparsedEntityDeclpublic void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notation)Receive notification of an unparsed entity declaration event.- Specified by:
- unparsedEntityDeclin interface- org.xml.sax.DTDHandler
- Overrides:
- unparsedEntityDeclin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- name- The unparsed entity name
- publicId- The public identifier (if any)
- systemId- The system identifier (if any)
- notation- The name of the associated notation
 
 - 
setEntityResolverpublic void setEntityResolver(org.xml.sax.EntityResolver entityResolver) 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 the- EntityResolverinterface.
 
 - 
getEntityResolverpublic org.xml.sax.EntityResolver getEntityResolver() Return the Entity Resolver used by the SAX parser.- Returns:
- Return the Entity Resolver used by the SAX parser.
 
 - 
resolveEntitypublic org.xml.sax.InputSource resolveEntity(java.lang.String name, java.lang.String publicId, java.lang.String baseURI, java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOException- Specified by:
- resolveEntityin interface- org.xml.sax.ext.EntityResolver2
- Overrides:
- resolveEntityin class- org.xml.sax.ext.DefaultHandler2
- Throws:
- org.xml.sax.SAXException
- java.io.IOException
 
 - 
startDTDpublic void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException- Specified by:
- startDTDin interface- org.xml.sax.ext.LexicalHandler
- Overrides:
- startDTDin class- org.xml.sax.ext.DefaultHandler2
- Throws:
- org.xml.sax.SAXException
 
 - 
errorpublic void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXExceptionForward notification of a parsing error to the application supplied error handler (if any).- Specified by:
- errorin interface- org.xml.sax.ErrorHandler
- Overrides:
- errorin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- exception- The error information
- Throws:
- org.xml.sax.SAXException- if a parsing exception occurs
 
 - 
fatalErrorpublic void fatalError(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXExceptionForward notification of a fatal parsing error to the application supplied error handler (if any).- Specified by:
- fatalErrorin interface- org.xml.sax.ErrorHandler
- Overrides:
- fatalErrorin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- exception- The fatal error information
- Throws:
- org.xml.sax.SAXException- if a parsing exception occurs
 
 - 
warningpublic void warning(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXExceptionForward notification of a parse warning to the application supplied error handler (if any).- Specified by:
- warningin interface- org.xml.sax.ErrorHandler
- Overrides:
- warningin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- exception- The warning information
- Throws:
- org.xml.sax.SAXException- if a parsing exception occurs
 
 - 
parsepublic java.lang.Object parse(java.io.File file) throws java.io.IOException, org.xml.sax.SAXExceptionParse the content of the specified file using this Digester. Returns the root element from the object stack (if any).- Parameters:
- file- File containing the XML data to be parsed
- Returns:
- the root object
- Throws:
- java.io.IOException- if an input/output error occurs
- org.xml.sax.SAXException- if a parsing exception occurs
 
 - 
parsepublic java.lang.Object parse(org.xml.sax.InputSource input) throws java.io.IOException, org.xml.sax.SAXExceptionParse the content of the specified input source using this Digester. Returns the root element from the object stack (if any).- Parameters:
- input- Input source containing the XML data to be parsed
- Returns:
- the root object
- Throws:
- java.io.IOException- if an input/output error occurs
- org.xml.sax.SAXException- if a parsing exception occurs
 
 - 
parsepublic java.lang.Object parse(java.io.InputStream input) throws java.io.IOException, org.xml.sax.SAXExceptionParse the content of the specified input stream using this Digester. Returns the root element from the object stack (if any).- Parameters:
- input- Input stream containing the XML data to be parsed
- Returns:
- the root object
- Throws:
- java.io.IOException- if an input/output error occurs
- org.xml.sax.SAXException- if a parsing exception occurs
 
 - 
registerpublic void register(java.lang.String publicId, java.lang.String entityURL)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(org.xml.sax.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 resolved
- entityURL- The URL to use for reading this DTD
 
 - 
addRulepublic void addRule(java.lang.String pattern, Rule rule)Register a new Rule matching the specified pattern. This method sets the Digesterproperty on the rule.- Parameters:
- pattern- Element matching pattern
- rule- Rule to be registered
 
 - 
addRuleSetpublic void addRuleSet(RuleSet ruleSet) Register a set of Rule instances defined in a RuleSet.- Parameters:
- ruleSet- The RuleSet instance to configure from
 
 - 
addCallMethodpublic void addCallMethod(java.lang.String pattern, java.lang.String methodName)Add an "call method" rule for a method which accepts no arguments.- Parameters:
- pattern- Element matching pattern
- methodName- Method name to be called
- See Also:
- CallMethodRule
 
 - 
addCallMethodpublic void addCallMethod(java.lang.String pattern, java.lang.String methodName, int paramCount)Add an "call method" rule for the specified parameters.- Parameters:
- pattern- Element matching pattern
- methodName- Method name to be called
- paramCount- Number of expected parameters (or zero for a single parameter from the body of this element)
- See Also:
- CallMethodRule
 
 - 
addCallParampublic void addCallParam(java.lang.String pattern, int paramIndex)Add a "call parameter" rule for the specified parameters.- Parameters:
- pattern- Element matching pattern
- paramIndex- Zero-relative parameter index to set (from the body of this element)
- See Also:
- CallParamRule
 
 - 
addFactoryCreatepublic void addFactoryCreate(java.lang.String pattern, ObjectCreationFactory creationFactory, boolean ignoreCreateExceptions)Add a "factory create" rule for the specified parameters.- Parameters:
- pattern- Element matching pattern
- creationFactory- Previously instantiated ObjectCreationFactory to be utilized
- ignoreCreateExceptions- when- trueany exceptions thrown during object creation will be ignored.
- See Also:
- FactoryCreateRule
 
 - 
addObjectCreatepublic void addObjectCreate(java.lang.String pattern, java.lang.String className)Add an "object create" rule for the specified parameters.- Parameters:
- pattern- Element matching pattern
- className- Java class name to be created
- See Also:
- ObjectCreateRule
 
 - 
addObjectCreatepublic void addObjectCreate(java.lang.String pattern, java.lang.String className, java.lang.String attributeName)Add an "object create" rule for the specified parameters.- Parameters:
- pattern- Element matching pattern
- className- Default Java class name to be created
- attributeName- Attribute name that optionally overrides the default Java class name to be created
- See Also:
- ObjectCreateRule
 
 - 
addSetNextpublic void addSetNext(java.lang.String pattern, java.lang.String methodName, java.lang.String paramType)Add a "set next" rule for the specified parameters.- Parameters:
- pattern- Element matching pattern
- methodName- Method name to call on the parent element
- paramType- Java class name of the expected parameter type (if you wish to use a primitive type, specify the corresponding Java wrapper class instead, such as- java.lang.Booleanfor a- booleanparameter)
- See Also:
- SetNextRule
 
 - 
addSetPropertiespublic void addSetProperties(java.lang.String pattern) Add a "set properties" rule for the specified parameters.- Parameters:
- pattern- Element matching pattern
- See Also:
- SetPropertiesRule
 
 - 
clearpublic void clear() Clear the current contents of the object stack.Calling this method might allow another document of the same type to be correctly parsed. However this method was not intended for this purpose. In general, a separate Digester object should be created for each document to be parsed. 
 - 
resetpublic void reset() 
 - 
peekpublic java.lang.Object peek() Return the top object on the stack without removing it. If there are no objects on the stack, returnnull.- Returns:
- the top object
 
 - 
peekpublic java.lang.Object peek(int n) Return the n'th object down the stack, where 0 is the top element and [getCount()-1] is the bottom element. If the specified index is out of range, returnnull.- Parameters:
- n- Index of the desired element, where 0 is the top of the stack, 1 is the next element down, and so on.
- Returns:
- the specified object
 
 - 
poppublic java.lang.Object pop() Pop the top object off of the stack, and return it. If there are no objects on the stack, returnnull.- Returns:
- the top object
 
 - 
pushpublic void push(java.lang.Object object) Push a new object onto the top of the object stack.- Parameters:
- object- The new object
 
 - 
getRootpublic java.lang.Object getRoot() When the Digester is being used as a SAXContentHandler, this method allows you to access the root object that has been created after parsing.- Returns:
- the root object that has been created after parsing or null if the digester has not parsed any XML yet.
 
 - 
configureprotected void configure() Provide a hook for lazy configuration of this Digesterinstance. The default implementation does nothing, but subclasses can override as needed.Note This method may be called more than once. 
 - 
peekParamspublic java.lang.Object peekParams() Return the top object on the parameters stack without removing it. If there are no objects on the stack, return null.The parameters stack is used to store CallMethodRuleparameters. Seeparams.- Returns:
- the top object on the parameters stack
 
 - 
popParamspublic java.lang.Object popParams() Pop the top object off of the parameters stack, and return it. If there are no objects on the stack, return null.The parameters stack is used to store CallMethodRuleparameters. Seeparams.- Returns:
- the top object on the parameters stack
 
 - 
pushParamspublic void pushParams(java.lang.Object object) Push a new object onto the top of the parameters stack. The parameters stack is used to store CallMethodRuleparameters. Seeparams.- Parameters:
- object- The new object
 
 - 
createSAXExceptionpublic org.xml.sax.SAXException createSAXException(java.lang.String message, java.lang.Exception e)Create a SAX exception which also understands about the location in the digester file where the exception occurs- Parameters:
- message- The error message
- e- The root cause
- Returns:
- the new exception
 
 - 
createSAXExceptionpublic org.xml.sax.SAXException createSAXException(java.lang.Exception e) Create a SAX exception which also understands about the location in the digester file where the exception occurs- Parameters:
- e- The root cause
- Returns:
- the new exception
 
 - 
createSAXExceptionpublic org.xml.sax.SAXException createSAXException(java.lang.String message) Create a SAX exception which also understands about the location in the digester file where the exception occurs- Parameters:
- message- The error message
- Returns:
- the new exception
 
 
- 
 
-