|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
org.apache.commons.digester.Digester
A 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
XmlMapper
class 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 or JAXP 1.2.1 to make that class working with XML schema
Field Summary | |
protected java.lang.StringBuffer |
bodyText
The body text of the current element. |
protected org.apache.commons.collections.ArrayStack |
bodyTexts
The stack of body text string buffers for surrounding elements. |
protected java.lang.ClassLoader |
classLoader
The class loader to use for instantiating application objects. |
protected boolean |
configured
Has this Digester been configured yet. |
protected java.util.HashMap |
entityValidator
The URLs of entityValidator that have been registered, keyed by the public identifier that corresponds. |
protected org.xml.sax.ErrorHandler |
errorHandler
The application-supplied error handler that is notified when parsing warnings, errors, or fatal errors occur. |
protected javax.xml.parsers.SAXParserFactory |
factory
The SAXParserFactory that is created the first time we need it. |
private java.lang.String |
JAXP_SCHEMA_LANGUAGE
The JAXP 1.2 property to set up the schemaLanguage used. |
private static java.lang.String |
JAXP_SCHEMA_SOURCE
The JAXP 1.2 property required to set up the schema location. |
protected org.xml.sax.Locator |
locator
The Locator associated with our parser. |
protected org.apache.commons.logging.Log |
log
The Log to which most logging calls will be made. |
protected java.lang.String |
match
The current match pattern for nested element processing. |
protected boolean |
namespaceAware
Do we want a "namespace aware" parser. |
protected java.util.HashMap |
namespaces
Registered namespaces we are currently processing. |
protected org.apache.commons.collections.ArrayStack |
params
The parameters stack being utilized by CallMethodRule and CallParamRule rules. |
protected javax.xml.parsers.SAXParser |
parser
The SAXParser we will use to parse the input stream. |
protected java.lang.String |
publicId
The public identifier of the DTD we are currently parsing under (if any). |
protected org.xml.sax.XMLReader |
reader
The XMLReader used to parse digester rules. |
protected java.lang.Object |
root
The "root" element of the stack (in other words, the last object that was popped. |
protected Rules |
rules
The Rules implementation containing our collection of
Rule instances and associated matching policy. |
private org.apache.commons.logging.Log |
saxLog
The Log to which all SAX event related logging calls will be made. |
private java.lang.String |
schemaLanguage
The XML schema language to use for validating an XML instance. |
private java.lang.String |
schemaLocation
The XML schema to use for validating an XML instance. |
protected org.apache.commons.collections.ArrayStack |
stack
The object stack being constructed. |
protected boolean |
useContextClassLoader
Do we want to use the Context ClassLoader when loading classes for instantiating new objects. |
protected boolean |
validating
Do we want to use a validating parser. |
private static java.lang.String |
W3C_XML_SCHEMA
The schema language supported. |
Constructor Summary | |
Digester()
Construct a new Digester with default properties. |
|
Digester(javax.xml.parsers.SAXParser parser)
Construct a new Digester, allowing a SAXParser to be passed in. |
|
Digester(org.xml.sax.XMLReader reader)
Construct a new Digester, allowing an XMLReader to be passed in. |
Method Summary | |
void |
addBeanPropertySetter(java.lang.String pattern)
Add a "bean property setter" rule for the specified parameters. |
void |
addBeanPropertySetter(java.lang.String pattern,
java.lang.String propertyName)
Add a "bean property setter" rule for the specified parameters. |
void |
addCallMethod(java.lang.String pattern,
java.lang.String methodName)
Add an "call method" rule for a method which accepts no arguments. |
void |
addCallMethod(java.lang.String pattern,
java.lang.String methodName,
int paramCount)
Add an "call method" rule for the specified parameters. |
void |
addCallMethod(java.lang.String pattern,
java.lang.String methodName,
int paramCount,
java.lang.Class[] paramTypes)
Add an "call method" rule for the specified parameters. |
void |
addCallMethod(java.lang.String pattern,
java.lang.String methodName,
int paramCount,
java.lang.String[] paramTypes)
Add an "call method" rule for the specified parameters. |
void |
addCallParam(java.lang.String pattern,
int paramIndex)
Add a "call parameter" rule for the specified parameters. |
void |
addCallParam(java.lang.String pattern,
int paramIndex,
java.lang.String attributeName)
Add a "call parameter" rule for the specified parameters. |
void |
addFactoryCreate(java.lang.String pattern,
java.lang.Class clazz)
Add a "factory create" rule for the specified parameters. |
void |
addFactoryCreate(java.lang.String pattern,
java.lang.Class clazz,
java.lang.String attributeName)
Add a "factory create" rule for the specified parameters. |
void |
addFactoryCreate(java.lang.String pattern,
ObjectCreationFactory creationFactory)
Add a "factory create" rule for the specified parameters. |
void |
addFactoryCreate(java.lang.String pattern,
java.lang.String className)
Add a "factory create" rule for the specified parameters. |
void |
addFactoryCreate(java.lang.String pattern,
java.lang.String className,
java.lang.String attributeName)
Add a "factory create" rule for the specified parameters. |
void |
addObjectCreate(java.lang.String pattern,
java.lang.Class clazz)
Add an "object create" rule for the specified parameters. |
void |
addObjectCreate(java.lang.String pattern,
java.lang.String className)
Add an "object create" rule for the specified parameters. |
void |
addObjectCreate(java.lang.String pattern,
java.lang.String attributeName,
java.lang.Class clazz)
Add an "object create" rule for the specified parameters. |
void |
addObjectCreate(java.lang.String pattern,
java.lang.String className,
java.lang.String attributeName)
Add an "object create" rule for the specified parameters. |
void |
addRule(java.lang.String pattern,
Rule rule)
Register a new Rule matching the specified pattern. |
void |
addRuleSet(RuleSet ruleSet)
Register a set of Rule instances defined in a RuleSet. |
void |
addSetNext(java.lang.String pattern,
java.lang.String methodName)
Add a "set next" rule for the specified parameters. |
void |
addSetNext(java.lang.String pattern,
java.lang.String methodName,
java.lang.String paramType)
Add a "set next" rule for the specified parameters. |
void |
addSetProperties(java.lang.String pattern)
Add a "set properties" rule for the specified parameters. |
void |
addSetProperties(java.lang.String pattern,
java.lang.String[] attributeNames,
java.lang.String[] propertyNames)
Add a "set properties" rule with overridden parameters. |
void |
addSetProperties(java.lang.String pattern,
java.lang.String attributeName,
java.lang.String propertyName)
Add a "set properties" rule with a single overridden parameter. |
void |
addSetProperty(java.lang.String pattern,
java.lang.String name,
java.lang.String value)
Add a "set property" rule for the specified parameters. |
void |
addSetRoot(java.lang.String pattern,
java.lang.String methodName)
Add SetRootRule with the specified parameters. |
void |
addSetRoot(java.lang.String pattern,
java.lang.String methodName,
java.lang.String paramType)
Add SetRootRule with the specified parameters. |
void |
addSetTop(java.lang.String pattern,
java.lang.String methodName)
Add a "set top" rule for the specified parameters. |
void |
addSetTop(java.lang.String pattern,
java.lang.String methodName,
java.lang.String paramType)
Add a "set top" rule for the specified parameters. |
void |
characters(char[] buffer,
int start,
int length)
Process notification of character data received from the body of an XML element. |
void |
clear()
Clear the current contents of the object stack. |
protected void |
configure()
Provide a hook for lazy configuration of this Digester
instance. |
protected 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 |
protected 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 |
protected 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 |
void |
endDocument()
Process notification of the end of the document being reached. |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
Process notification of the end of an XML element being reached. |
void |
endPrefixMapping(java.lang.String prefix)
Process notification that a namespace prefix is going out of scope. |
void |
error(org.xml.sax.SAXParseException exception)
Forward notification of a parsing error to the application supplied error handler (if any). |
void |
fatalError(org.xml.sax.SAXParseException exception)
Forward notification of a fatal parsing error to the application supplied error handler (if any). |
java.lang.String |
findNamespaceURI(java.lang.String prefix)
Return the currently mapped namespace URI for the specified prefix, if any; otherwise return null . |
java.lang.ClassLoader |
getClassLoader()
Return the class loader to be used for instantiating application objects when required. |
int |
getCount()
Return the current depth of the element stack. |
java.lang.String |
getCurrentElementName()
Return the name of the XML element that is currently being processed. |
int |
getDebug()
Deprecated. Configure the logger using standard mechanisms for your implementation |
org.xml.sax.ErrorHandler |
getErrorHandler()
Return the error handler for this Digester. |
javax.xml.parsers.SAXParserFactory |
getFactory()
Return the SAXParserFactory we will use, creating one if necessary. |
boolean |
getFeature(java.lang.String feature)
Returns a flag indicating whether the requested feature is supported by the underlying implementation of org.xml.sax.XMLReader . |
org.apache.commons.logging.Log |
getLogger()
Return the current Logger associated with this instance of the Digester |
java.lang.String |
getMatch()
Return the current rule match path |
boolean |
getNamespaceAware()
Return the "namespace aware" flag for parsers we create. |
javax.xml.parsers.SAXParser |
getParser()
Return the SAXParser we will use to parse the input stream. |
java.lang.Object |
getProperty(java.lang.String property)
Return the current value of the specified property for the underlying XMLReader implementation. |
java.lang.String |
getPublicId()
Return the public identifier of the DTD we are currently parsing under, if any. |
org.xml.sax.XMLReader |
getReader()
Deprecated. Use getXMLReader() instead, which can throw a SAXException if the reader cannot be instantiated |
(package private) java.util.Map |
getRegistrations()
Return the set of DTD URL registrations, keyed by public identifier. |
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. |
java.lang.String |
getRuleNamespaceURI()
Return the namespace URI that will be applied to all subsequently added Rule objects. |
Rules |
getRules()
Return the Rules implementation object containing our
rules collection and associated matching policy. |
(package private) java.util.List |
getRules(java.lang.String match)
Deprecated. Call match() on the Rules
implementation returned by getRules() |
java.lang.String |
getSchema()
Return the XML Schema URI used for validating an XML instance. |
java.lang.String |
getSchemaLanguage()
Return the XML Schema language used when parsing. |
boolean |
getUseContextClassLoader()
Return the boolean as to whether the context classloader should be used. |
boolean |
getValidating()
Return the validating parser flag. |
org.xml.sax.XMLReader |
getXMLReader()
Return the XMLReader to be used for parsing the input document. |
void |
ignorableWhitespace(char[] buffer,
int start,
int len)
Process notification of ignorable whitespace received from the body of an XML element. |
void |
log(java.lang.String message)
Deprecated. Call getLogger() and use it's logging methods |
void |
log(java.lang.String message,
java.lang.Throwable exception)
Deprecated. Call getLogger() and use it's logging methods |
void |
notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Receive notification of a notation declaration event. |
java.lang.Object |
parse(java.io.File file)
Parse the content of the specified file using this Digester. |
java.lang.Object |
parse(org.xml.sax.InputSource input)
Parse the content of the specified input source using this Digester. |
java.lang.Object |
parse(java.io.InputStream input)
Parse the content of the specified input stream using this Digester. |
java.lang.Object |
parse(java.io.Reader reader)
Parse the content of the specified reader using this Digester. |
java.lang.Object |
parse(java.lang.String uri)
Parse the content of the specified URI using this Digester. |
java.lang.Object |
peek()
Return the top object on the stack without removing it. |
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. |
(package private) java.lang.Object |
peekParams()
Return the top object on the parameters stack without removing it. |
(package private) java.lang.Object |
peekParams(int n)
Return the n'th object down the parameters stack, where 0 is the top element and [getCount()-1] is the bottom element. |
java.lang.Object |
pop()
Pop the top object off of the stack, and return it. |
(package private) java.lang.Object |
popParams()
Pop the top object off of the parameters stack, and return it. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Process notification of a processing instruction that was encountered. |
void |
push(java.lang.Object object)
Push a new object onto the top of the object stack. |
(package private) void |
pushParams(java.lang.Object object)
Push a new object onto the top of the parameters stack. |
void |
register(java.lang.String publicId,
java.lang.String entityURL)
Register the specified DTD URL for the specified public identifier. |
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.String systemId)
Resolve the requested external entity. |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Set the class loader to be used for instantiating application objects when required. |
void |
setDebug(int debug)
Deprecated. Configure the logger using standard mechanisms for your implementation |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Set the document locator associated with our parser. |
void |
setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
Set the error handler for this Digester. |
void |
setFeature(java.lang.String feature,
boolean value)
Sets a flag indicating whether the requested feature is supported by the underlying implementation of org.xml.sax.XMLReader . |
void |
setLogger(org.apache.commons.logging.Log log)
Set the current logger for this Digester. |
void |
setNamespaceAware(boolean namespaceAware)
Set the "namespace aware" flag for parsers we create. |
void |
setProperty(java.lang.String property,
java.lang.Object value)
Set the current value of the specified property for the underlying XMLReader implementation. |
void |
setRuleNamespaceURI(java.lang.String ruleNamespaceURI)
Set the namespace URI that will be applied to all subsequently added Rule objects. |
void |
setRules(Rules rules)
Set the Rules implementation object containing our
rules collection and associated matching policy. |
void |
setSchema(java.lang.String schemaLocation)
Set the XML Schema URI used for validating a XML Instance. |
void |
setSchemaLanguage(java.lang.String schemaLanguage)
Set the XML Schema language used when parsing. |
void |
setUseContextClassLoader(boolean use)
Determine whether to use the Context ClassLoader (the one found by calling Thread.currentThread().getContextClassLoader() )
to resolve/load classes that are defined in various rules. |
void |
setValidating(boolean validating)
Set the validating parser flag. |
void |
skippedEntity(java.lang.String name)
Process notification of a skipped entity. |
void |
startDocument()
Process notification of the beginning of the document being reached. |
void |
startElement(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. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String namespaceURI)
Process notification that a namespace prefix is coming in to scope. |
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. |
void |
warning(org.xml.sax.SAXParseException exception)
Forward notification of a parse warning to the application supplied error handler (if any). |
Field Detail |
protected java.lang.StringBuffer bodyText
protected org.apache.commons.collections.ArrayStack bodyTexts
protected java.lang.ClassLoader classLoader
useContextClassLoader
variable.protected boolean configured
protected java.util.HashMap entityValidator
protected org.xml.sax.ErrorHandler errorHandler
protected javax.xml.parsers.SAXParserFactory factory
private static final java.lang.String JAXP_SCHEMA_SOURCE
private java.lang.String JAXP_SCHEMA_LANGUAGE
protected org.xml.sax.Locator locator
protected java.lang.String match
protected boolean namespaceAware
protected java.util.HashMap namespaces
protected org.apache.commons.collections.ArrayStack params
protected javax.xml.parsers.SAXParser parser
protected java.lang.String publicId
protected org.xml.sax.XMLReader reader
protected java.lang.Object root
protected Rules rules
Rules
implementation containing our collection of
Rule
instances and associated matching policy. If not
established before the first rule is added, a default implementation
will be provided.private java.lang.String schemaLanguage
W3C_XML_SCHEMA
private java.lang.String schemaLocation
protected org.apache.commons.collections.ArrayStack stack
protected boolean useContextClassLoader
false
.protected boolean validating
protected org.apache.commons.logging.Log log
private org.apache.commons.logging.Log saxLog
private static final java.lang.String W3C_XML_SCHEMA
Constructor Detail |
public Digester()
public Digester(javax.xml.parsers.SAXParser parser)
public Digester(org.xml.sax.XMLReader reader)
Method Detail |
public java.lang.String findNamespaceURI(java.lang.String prefix)
null
. These mappings come and
go dynamically as the document is parsed.prefix
- Prefix to look uppublic java.lang.ClassLoader getClassLoader()
setClassLoader()
, if anyuseContextClassLoader
property is set to truepublic void setClassLoader(java.lang.ClassLoader classLoader)
classLoader
- The new class loader to use, or null
to revert to the standard rulespublic int getCount()
public java.lang.String getCurrentElementName()
public int getDebug()
public void setDebug(int debug)
debug
- New debugging detail level (0=off, increasing integers
for more detail)public org.xml.sax.ErrorHandler getErrorHandler()
public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
errorHandler
- The new error handlerpublic javax.xml.parsers.SAXParserFactory getFactory()
public boolean getFeature(java.lang.String feature) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
org.xml.sax.XMLReader
.
See
for information about the standard SAX2 feature flags.feature
- Name of the feature to inquire aboutParserConfigurationException
- if a parser configuration error
occursSAXNotRecognizedException
- if the property name is
not recognizedSAXNotSupportedException
- if the property name is
recognized but not supportedpublic void setFeature(java.lang.String feature, boolean value) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
org.xml.sax.XMLReader
.
See
for information about the standard SAX2 feature flags. In order to be
effective, this method must be called before the
getParser()
method is called for the first time, either
directly or indirectly.feature
- Name of the feature to set the status forvalue
- The new value for this featureParserConfigurationException
- if a parser configuration error
occursSAXNotRecognizedException
- if the property name is
not recognizedSAXNotSupportedException
- if the property name is
recognized but not supportedpublic org.apache.commons.logging.Log getLogger()
public void setLogger(org.apache.commons.logging.Log log)
public java.lang.String getMatch()
public boolean getNamespaceAware()
public void setNamespaceAware(boolean namespaceAware)
namespaceAware
- The new "namespace aware" flagpublic java.lang.String getPublicId()
public java.lang.String getRuleNamespaceURI()
Rule
objects.public void setRuleNamespaceURI(java.lang.String ruleNamespaceURI)
Rule
objects.ruleNamespaceURI
- Namespace URI that must match on all
subsequently added rules, or null
for matching
regardless of the current namespace URIpublic javax.xml.parsers.SAXParser getParser()
null
.public java.lang.Object getProperty(java.lang.String property) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
XMLReader
implementation.
See
for information about the standard SAX2 properties.property
- Property name to be retrievedSAXNotRecognizedException
- if the property name is
not recognizedSAXNotSupportedException
- if the property name is
recognized but not supportedpublic void setProperty(java.lang.String property, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
XMLReader
implementation.
See
for information about the standard SAX2 properties.property
- Property name to be setvalue
- Property value to be setSAXNotRecognizedException
- if the property name is
not recognizedSAXNotSupportedException
- if the property name is
recognized but not supportedpublic org.xml.sax.XMLReader getReader()
public Rules getRules()
Rules
implementation object containing our
rules collection and associated matching policy. If none has been
established, a default implementation will be created and returned.public void setRules(Rules rules)
Rules
implementation object containing our
rules collection and associated matching policy.rules
- New Rules implementationpublic java.lang.String getSchema()
public void setSchema(java.lang.String schemaLocation)
schemaLocation
- a URI to the schema.public java.lang.String getSchemaLanguage()
public void setSchemaLanguage(java.lang.String schemaLanguage)
schemaLanguage
- a URI to the schema language.public boolean getUseContextClassLoader()
public void setUseContextClassLoader(boolean use)
Thread.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.boolean
- determines whether to use Context ClassLoader.public boolean getValidating()
public void setValidating(boolean validating)
parse()
is called the first time.validating
- The new validating parser flag.public org.xml.sax.XMLReader getXMLReader() throws org.xml.sax.SAXException
SAXException
- if no XMLReader can be instantiatedpublic void characters(char[] buffer, int start, int length) throws org.xml.sax.SAXException
buffer
- The characters from the XML documentstart
- Starting offset into the bufferlength
- Number of characters from the bufferSAXException
- if a parsing error is to be reportedpublic void endDocument() throws org.xml.sax.SAXException
SAXException
- if a parsing error is to be reportedpublic void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
uri
- - 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.SAXException
- if a parsing error is to be reportedpublic void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
prefix
- Prefix that is going out of scopeSAXException
- if a parsing error is to be reportedpublic void ignorableWhitespace(char[] buffer, int start, int len) throws org.xml.sax.SAXException
buffer
- The characters from the XML documentstart
- Starting offset into the bufferlength
- Number of characters from the bufferSAXException
- if a parsing error is to be reportedpublic void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
target
- The processing instruction targetdata
- The processing instruction data (if any)SAXException
- if a parsing error is to be reportedpublic void setDocumentLocator(org.xml.sax.Locator locator)
locator
- The new locatorpublic void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
name
- Name of the skipped entitySAXException
- if a parsing error is to be reportedpublic void startDocument() throws org.xml.sax.SAXException
SAXException
- if a parsing error is to be reportedpublic void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes list) throws org.xml.sax.SAXException
uri
- 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.SAXException
- if a parsing error is to be reportedpublic void startPrefixMapping(java.lang.String prefix, java.lang.String namespaceURI) throws org.xml.sax.SAXException
prefix
- Prefix that is being declarednamespaceURI
- Corresponding namespace URI being mapped toSAXException
- if a parsing error is to be reportedpublic void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
name
- The notation namepublicId
- The public identifier (if any)systemId
- The system identifier (if any)public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notation)
name
- The unparsed entity namepublicId
- The public identifier (if any)systemId
- The system identifier (if any)notation
- The name of the associated notationpublic org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
publicId
- The public identifier of the entity being referencedsystemId
- The system identifier of the entity being referencedSAXException
- if a parsing exception occurs
<public void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
exception
- The error informationSAXException
- if a parsing exception occurspublic void fatalError(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
exception
- The fatal error informationSAXException
- if a parsing exception occurspublic void warning(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
exception
- The warning informationSAXException
- if a parsing exception occurspublic void log(java.lang.String message)
message
- The message to be loggedpublic void log(java.lang.String message, java.lang.Throwable exception)
message
- The message to be loggedpublic java.lang.Object parse(java.io.File file) throws java.io.IOException, org.xml.sax.SAXException
file
- File containing the XML data to be parsedjava.io.IOException
- if an input/output error occursSAXException
- if a parsing exception occurspublic java.lang.Object parse(org.xml.sax.InputSource input) throws java.io.IOException, org.xml.sax.SAXException
input
- Input source containing the XML data to be parsedjava.io.IOException
- if an input/output error occursSAXException
- if a parsing exception occurspublic java.lang.Object parse(java.io.InputStream input) throws java.io.IOException, org.xml.sax.SAXException
input
- Input stream containing the XML data to be parsedjava.io.IOException
- if an input/output error occursSAXException
- if a parsing exception occurspublic java.lang.Object parse(java.io.Reader reader) throws java.io.IOException, org.xml.sax.SAXException
reader
- Reader containing the XML data to be parsedjava.io.IOException
- if an input/output error occursSAXException
- if a parsing exception occurspublic java.lang.Object parse(java.lang.String uri) throws java.io.IOException, org.xml.sax.SAXException
uri
- URI containing the XML data to be parsedjava.io.IOException
- if an input/output error occursSAXException
- if a parsing exception occurspublic void register(java.lang.String publicId, java.lang.String entityURL)
parse()
.publicId
- Public identifier of the DTD to be resolvedentityURL
- The URL to use for reading this DTDpublic void addRule(java.lang.String pattern, Rule rule)
Register a new Rule matching the specified pattern.
This method sets the Digester
property on the rule.
pattern
- Element matching patternrule
- Rule to be registeredpublic void addRuleSet(RuleSet ruleSet)
ruleSet
- The RuleSet instance to configure frompublic void addBeanPropertySetter(java.lang.String pattern)
pattern
- Element matching patternpublic void addBeanPropertySetter(java.lang.String pattern, java.lang.String propertyName)
pattern
- Element matching patternpropertyName
- Name of property to setpublic void addCallMethod(java.lang.String pattern, java.lang.String methodName)
pattern
- Element matching patternmethodName
- Method name to be calledpublic void addCallMethod(java.lang.String pattern, java.lang.String methodName, int paramCount)
pattern
- Element matching patternmethodName
- Method name to be calledparamCount
- Number of expected parameters (or zero
for a single parameter from the body of this element)public void addCallMethod(java.lang.String pattern, java.lang.String methodName, int paramCount, java.lang.String[] paramTypes)
paramCount
is set to zero the rule will use
the body of the matched element as the single argument of the
method, unless paramTypes
is null or empty, in this
case the rule will call the specified method with no arguments.pattern
- Element matching patternmethodName
- Method name to be calledparamCount
- Number of expected parameters (or zero
for a single parameter from the body of this element)paramTypes
- Set of Java class names for the types
of the expected parameters
(if you wish to use a primitive type, specify the corresonding
Java wrapper class instead, such as java.lang.Boolean
for a boolean
parameter)public void addCallMethod(java.lang.String pattern, java.lang.String methodName, int paramCount, java.lang.Class[] paramTypes)
paramCount
is set to zero the rule will use
the body of the matched element as the single argument of the
method, unless paramTypes
is null or empty, in this
case the rule will call the specified method with no arguments.pattern
- Element matching patternmethodName
- Method name to be calledparamCount
- Number of expected parameters (or zero
for a single parameter from the body of this element)paramTypes
- The Java class names of the arguments
(if you wish to use a primitive type, specify the corresonding
Java wrapper class instead, such as java.lang.Boolean
for a boolean
parameter)public void addCallParam(java.lang.String pattern, int paramIndex)
pattern
- Element matching patternparamIndex
- Zero-relative parameter index to set
(from the body of this element)public void addCallParam(java.lang.String pattern, int paramIndex, java.lang.String attributeName)
pattern
- Element matching patternparamIndex
- Zero-relative parameter index to set
(from the specified attribute)attributeName
- Attribute whose value is used as the
parameter valuepublic void addFactoryCreate(java.lang.String pattern, java.lang.String className)
pattern
- Element matching patternclassName
- Java class name of the object creation factory classpublic void addFactoryCreate(java.lang.String pattern, java.lang.Class clazz)
pattern
- Element matching patternclazz
- Java class of the object creation factory classpublic void addFactoryCreate(java.lang.String pattern, java.lang.String className, java.lang.String attributeName)
pattern
- Element matching patternclassName
- Java class name of the object creation factory classattributeName
- Attribute name which, if present, overrides the
value specified by className
public void addFactoryCreate(java.lang.String pattern, java.lang.Class clazz, java.lang.String attributeName)
pattern
- Element matching patternclazz
- Java class of the object creation factory classattributeName
- Attribute name which, if present, overrides the
value specified by className
public void addFactoryCreate(java.lang.String pattern, ObjectCreationFactory creationFactory)
pattern
- Element matching patterncreationFactory
- Previously instantiated ObjectCreationFactory
to be utilizedpublic void addObjectCreate(java.lang.String pattern, java.lang.String className)
pattern
- Element matching patternclassName
- Java class name to be createdpublic void addObjectCreate(java.lang.String pattern, java.lang.Class clazz)
pattern
- Element matching patternclazz
- Java class to be createdpublic void addObjectCreate(java.lang.String pattern, java.lang.String className, java.lang.String attributeName)
pattern
- Element matching patternclassName
- Default Java class name to be createdattributeName
- Attribute name that optionally overrides
the default Java class name to be createdpublic void addObjectCreate(java.lang.String pattern, java.lang.String attributeName, java.lang.Class clazz)
pattern
- Element matching patternattributeName
- Attribute name that optionally overridesclazz
- Default Java class to be created
the default Java class name to be createdpublic void addSetNext(java.lang.String pattern, java.lang.String methodName)
pattern
- Element matching patternmethodName
- Method name to call on the parent elementpublic void addSetNext(java.lang.String pattern, java.lang.String methodName, java.lang.String paramType)
pattern
- Element matching patternmethodName
- Method name to call on the parent elementparamType
- Java class name of the expected parameter type
(if you wish to use a primitive type, specify the corresonding
Java wrapper class instead, such as java.lang.Boolean
for a boolean
parameter)public void addSetRoot(java.lang.String pattern, java.lang.String methodName)
SetRootRule
with the specified parameters.pattern
- Element matching patternmethodName
- Method name to call on the root objectpublic void addSetRoot(java.lang.String pattern, java.lang.String methodName, java.lang.String paramType)
SetRootRule
with the specified parameters.pattern
- Element matching patternmethodName
- Method name to call on the root objectparamType
- Java class name of the expected parameter typepublic void addSetProperties(java.lang.String pattern)
pattern
- Element matching patternpublic void addSetProperties(java.lang.String pattern, java.lang.String attributeName, java.lang.String propertyName)
SetPropertiesRule.SetPropertiesRule(String attributeName, String propertyName)
pattern
- Element matching patternattributeName
- map this attributepropertyNames
- to this propertypublic void addSetProperties(java.lang.String pattern, java.lang.String[] attributeNames, java.lang.String[] propertyNames)
SetPropertiesRule.SetPropertiesRule(String [] attributeNames, String [] propertyNames)
pattern
- Element matching patternattributeNames
- names of attributes with custom mappingspropertyNames
- property names these attributes map topublic void addSetProperty(java.lang.String pattern, java.lang.String name, java.lang.String value)
pattern
- Element matching patternname
- Attribute name containing the property name to be setvalue
- Attribute name containing the property value to setpublic void addSetTop(java.lang.String pattern, java.lang.String methodName)
pattern
- Element matching patternmethodName
- Method name to call on the parent elementpublic void addSetTop(java.lang.String pattern, java.lang.String methodName, java.lang.String paramType)
pattern
- Element matching patternmethodName
- Method name to call on the parent elementparamType
- Java class name of the expected parameter type
(if you wish to use a primitive type, specify the corresonding
Java wrapper class instead, such as java.lang.Boolean
for a boolean
parameter)public void clear()
public java.lang.Object peek()
null
.public java.lang.Object peek(int n)
null
.n
- Index of the desired element, where 0 is the top of the stack,
1 is the next element down, and so on.public java.lang.Object pop()
null
.public void push(java.lang.Object object)
object
- The new objectpublic java.lang.Object getRoot()
protected void configure()
Digester
instance. The default implementation does nothing, but subclasses
can override as needed.java.util.Map getRegistrations()
java.util.List getRules(java.lang.String match)
match()
on the Rules
implementation returned by getRules()
match
- The current match positionjava.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 CallMethodRule
parameters.
See params
.
java.lang.Object peekParams(int n)
Return the n'th object down the parameters stack, where 0 is the top element
and [getCount()-1] is the bottom element. If the specified index
is out of range, return null
.
The parameters stack is used to store CallMethodRule
parameters.
See params
.
n
- Index of the desired element, where 0 is the top of the stack,
1 is the next element down, and so on.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 CallMethodRule
parameters.
See params
.
void pushParams(java.lang.Object object)
Push a new object onto the top of the parameters stack.
The parameters stack is used to store CallMethodRule
parameters.
See params
.
object
- The new objectprotected org.xml.sax.SAXException createSAXException(java.lang.String message, java.lang.Exception e)
protected org.xml.sax.SAXException createSAXException(java.lang.Exception e)
protected org.xml.sax.SAXException createSAXException(java.lang.String message)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |