org.apache.commons.digester.Digester继承自org.xml.sax.helpers.DefaultHandler。
在其API中是如下定义的:
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.
构造方法:
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.
其他常用方法:
addSetNext(java.lang.String pattern, java.lang.String methodName)
addSetNext(java.lang.String pattern, java.lang.String methodName, java.lang.String paramType)
Add a "set next" rule for the specified parameters.
addSetProperties(java.lang.String pattern)
Add a "set properties" rule for the specified parameters.
addSetProperties(java.lang.String pattern, java.lang.String[] attributeNames, java.lang.String[] propertyNames)
Add a "set properties" rule with overridden parameters.
addSetProperties(java.lang.String pattern, java.lang.String attributeName, java.lang.String propertyName)
Add a "set properties" rule with a single overridden parameter.
addSetProperty(java.lang.String pattern, java.lang.String name, java.lang.String value)
Add a "set property" rule for the specified parameters.
parse(org.xml.sax.InputSource input)
Parse the content of the specified input source using this Digester.
parse(java.io.InputStream input)
Parse the content of the specified input stream using this Digester.
parse(java.io.Reader reader)
Parse the content of the specified reader using this Digester.
parse(java.lang.String uri)
Parse the content of the specified URI using this Digester.
parse(java.net.URL url)
Parse the content of the specified URL using this Digester.
setDebug(int debug)
Deprecated. This method now has no effect at all. Digester uses the apache jakarta comons-logging library;
push(java.lang.Object object)
Push a new object onto the top of the object stack.
push(java.lang.String stackName, java.lang.Object value)
Pushes the given object onto the stack with the given name.
setValidating(boolean validating)
Set the validating parser flag.