Digester类的一些方法

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.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值