org.apache.commons.digester.Digester使用

org.apache.commons.digester解析XML.rar org.apache.commons.digester解析XML.rar 完整的测试工程,里面有需要的四个包 立即下载
 

commons.digester软件包学习

   http://www.onjava.com/pub/a/onjava/2002/10/23/digester.html?page=1

它能方便地将XML文档所定义的元素转化为JAVA对象,其实它的用法有点象栈(当然内在的原理就是那个古老的东西,只是提供了更高一层的封装)。
      //
生成一个digester。主要需要引进commons-logging.jar、commons-collections.jar、commons-       beanutils.jar
          Digester digester = new Digester();
         
          //
设置对XML文档资料是否进行DTD验证

          digester.setValidating( false );
         
          //
当遇见 catalog 元素的时候,产生一个Catalog对象
          digester.addObjectCreate( "catalog", Catalog.class );
         
          //
当遇见 catalog 元素下面的book的时候,产生一个Book对象
          digester.addObjectCreate( "catalog/book", Book.class );
          //
当遇见 catalog 元素下面的book的author时候,调用author属性的Set方法
          digester.addBeanPropertySetter( "catalog/book/author", "author" );
          digester.addBeanPropertySetter( "catalog/book/title", "title" );
          //
当再一次遇见 catalog 元素下面的book的时候,调用catalog类的addBook()方法
          digester.addSetNext( "catalog/book", "addBook" );

          digester.addObjectCreate( "catalog/magazine", Magazine.class );
          digester.addBeanPropertySetter( "catalog/magazine/name", "name" );

          digester.addObjectCreate( "catalog/magazine/article", Article.class );
          //addSetProperties
()是将对应元素的属性赋值。
          digester.addSetProperties( "catalog/magazine/article", "page", "page" );
          digester.addBeanPropertySetter( "catalog/magazine/article/headline" );
          digester.addSetNext( "catalog/magazine/article", "addArticle" );

          digester.addSetNext( "catalog/magazine", "addMagazine" );
          //"F://Digester//catalog.xml"
为XML文档
          File input = new File( "F://Digester//catalog.xml" );
          Catalog c = (Catalog)digester.parse( input );
          System.out.println( c.toString() );
在测试以上网站的例子的时候引进:commons-digester.jar,另外请你引进:commons-logging.jar、commons-collections.jar、commons-beanutils.jar
这是因为在执行: Digester digester = new Digester();的时候配置了LOG(在apache下面的很多组件都会用到它的公用组件)。

 

 

Learning and Using Jakarta Digester

by Philipp K. Janert, Ph.D.
10/23/2002

Turning an XML document into a corresponding hierarchy of Java bean objects is a fairly common task. In a previous article, I described how to accomplish this using the standard SAX and DOM APIs.

<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript> </script>

Although powerful and flexible, both APIs are, in effect, too low-level for the specific task at hand. Furthermore, the unmarshalling procedure itself requires a fair amount of coding: a parse-stack must be maintained when using SAX, and the DOM-tree must be navigated when using DOM.

This is where the Apache Jakarta Commons Digester framework comes in.

The Jakarta Digester Framework

The Jakarta Digester framework grew out of the Jakarta Struts Web toolkit. Originally developed to process the central struts-config.xml configuration file, it was soon recognized that the framework was more generally useful, and moved to the Jakarta Commons project, the stated goal of which is to provide a "repository of reusable Java components." The most recent version, Digester 1.3, was released on August 13, 2002.

The Digester class lets the application programmer specify a set of actions to be performed whenever the parser encounters certain simple patterns in the XML document. The Digester framework comes with 10 prepackaged "rules," which cover most of the required tasks when unmarshalling XML (such as creating a bean or setting a bean property), but each user is free to define and implement his or her own rules, as necessary.

The Example Document and Beans

In this example, we will unmarshall the same XML document that we used in the previous article:

<?xml version="1.0"?>

 

<catalog library="somewhere">

 

   <book>

      <author>Author 1</author>

      <title>Title 1</title>

   </book>

 

   <book>

      <author>Author 2</author>

      <title>His One Book</title>

   </book>

 

   <magazine>

      <name>Mag Title 1</name>

 

      <article page="5">

         <headline>Some Headline</headline>

      </article>

 

      <article page="9">

         <headline>Another Headline</headline>

      </article>

   </magazine>

 

   <book>

      <author>Author 2</author>

      <title>His Other Book</title>

   </book>

 

   <magazine>

      <name>Mag Title 2</name>

 

      <article page="17">

         <headline>Second Headline</headline>

      </article>

   </magazine>

 

</catalog>

The bean classes are also the same, except for one important change: In the previous article, I had declared these classes to have package scope -- primarily so that I could define all of them in the same source file! Using the Digester framework, this is no longer possible; the classes need to be declared as public (as is required for classes conforming to the JavaBeans specification):

import java.util.Vector;

 

public class Catalog {

   private Vector books;

   private Vector magazines;

 

   public Catalog() {

      books = new Vector();

      magazines = new Vector();

   }

 

   public void addBook( Book rhs ) {

      books.addElement( rhs );

   }

   public void addMagazine( Magazine rhs ) {

      magazines.addElement( rhs );

   }

 

   public String toString() {

      String newline = System.getProperty( "line.separator" );

      StringBuffer buf = new StringBuffer();

 

      buf.append( "--- Books ---" ).append( newline );

      for( int i=0; i<books.size(); i++ ){

         buf.append( books.elementAt(i) ).append( newline );

      }

 

      buf.append( "--- Magazines ---" ).append( newline );

      for( int i=0; i<magazines.size(); i++ ){

         buf.append( magazines.elementAt(i) ).append( newline );

      }

 

      return buf.toString();

   }

}


public class Book {

   private String author;

   private String title;

 

   public Book() {}

 

   public void setAuthor( String rhs ) { author = rhs; }

   public void setTitle(  String rhs ) { title  = rhs; }

 

   public String toString() {

      return "Book: Author='" + author + "' Title='" + title + "'";

   }

}


import java.util.Vector;

 

public class Magazine {

   private String name;

   private Vector articles;

 

   public Magazine() {

      articles = new Vector();

   }

 

   public void setName( String rhs ) { name = rhs; }

 

   public void addArticle( Article a ) {

      articles.addElement( a );

   }

 

   public String toString() {

      StringBuffer buf = new StringBuffer( "Magazine: Name='" + name + "' ");

      for( int i=0; i<articles.size(); i++ ){

         buf.append( articles.elementAt(i).toString() );

      }

      return buf.toString();

   }

}


public class Article {

   private String headline;

   private String page;

 

   public Article() {}

 

   public void setHeadline( String rhs ) { headline = rhs; }

   public void setPage(     String rhs ) { page     = rhs; }

 

   public String toString() {

      return "Article: Headline='" + headline + "' on page='" + page + "' ";

   }

}

import org.apache.commons.digester.*;
       

   
     
   
import java.io.*;
       
import java.util.*;
       

   
     
   
public class DigesterDriver {
       

   
     
   
   public static void main( String[] args ) {
       

   
     
   
      try {
       
         Digester digester = new Digester();
       
         digester.setValidating( false );
       

   
     
   
         digester.addObjectCreate( "catalog", Catalog.class );
       

   
     
   
         digester.addObjectCreate( "catalog/book", Book.class );
       
         digester.addBeanPropertySetter( "catalog/book/author", "author" );
       
         digester.addBeanPropertySetter( "catalog/book/title", "title" );
       
         digester.addSetNext( "catalog/book", "addBook" );
       

   
     
   
         digester.addObjectCreate( "catalog/magazine", Magazine.class );
       
         digester.addBeanPropertySetter( "catalog/magazine/name", "name" );
       

   
     
   
         digester.addObjectCreate( "catalog/magazine/article", Article.class );
       
         digester.addSetProperties( "catalog/magazine/article", "page", "page" );
       
         digester.addBeanPropertySetter( "catalog/magazine/article/headline" ); 
       
         digester.addSetNext( "catalog/magazine/article", "addArticle" );
       

   
     
   
         digester.addSetNext( "catalog/magazine", "addMagazine" );
       

   
     
   
         File input = new File( args[0] );
       
         Catalog c = (Catalog)digester.parse( input );
       

   
     
   
         System.out.println( c.toString() );
       

   
     
   
      } catch( Exception exc ) {
       
         exc.printStackTrace();
       
      }
       
   }
       
}

After instantiating the Digester, we specify that it should not validate the XML document against a DTD -- because we did not define one for our simple Catalog document. Then we specify the patterns and the associated rules: the ObjectCreateRule creates an instance of the specified class and pushes it onto the parse stack. The SetPropertiesRule sets a bean property to the value of an XML attribute of the current element -- the first argument to the rule is the name of the attribute, the second, the name of the property.

Whereas SetPropertiesRule takes the value from an attribute, BeanPropertySetterRule takes the value from the raw character data nested inside of the current element. It is not necessary to specify the name of the property to set when using BeanPropertySetterRule: it defaults to the name of the current XML element. In the example above, this default is being used in the rule definition matching the catalog/magazine/article/headline pattern. Finally, the SetNextRule pops the object on top of the parse stack and passes it to the named method on the object below it -- it is commonly used to insert a finished bean into its parent.

Note that it is possible to register several rules for the same pattern. If this occurs, the rules are executed in the order in which they are added to the Digester -- for instance, to deal with the <article> element, found at catalog/magazine/article, we first create the appropriate article bean, then set the page property, and finally pop the completed article bean and insert it into its magazine parent.

Invoking Arbitrary Functions

It is not only possible to set bean properties, but to invoke arbitrary methods on objects in the stack. This is accomplished using the CallMethodRule to specify the method name and, optionally, the number and type of arguments passed to it. Subsequent specifications of the CallParamRule define the parameter values to be passed to the invoked functions. The values can be taken either from named attributes of the current XML element, or from the raw character data contained by the current element. For instance, rather than using the BeanPropertySetterRule in the DigesterDriver implementation above, we could have achieved the same effect by calling the property setter explicitly, and passing the data as parameter:

   digester.addCallMethod( "catalog/book/author", "setAuthor", 1 );
       
   digester.addCallParam( "catalog/book/author", 0 );

The first line gives the name of the method to call (setAuthor()), and the expected number of parameters (1). The second line says to take the value of the function parameter from the character data contained in the <author> element and pass it as first element in the array of arguments (i.e., the array element with index 0). Had we also specified an attribute name (e.g., digester.addCallParam( "catalog/book/author", 0, "author" );), the value would have been taken from the respective attribute of the current element instead.

One important caveat: confusingly, digester.addCallMethod( "pattern", "methodName", 0 ); does not specify a call to a method taking no arguments -- instead, it specifies a call to a method taking one argument, the value of which is taken from the character data of the current XML element! We therefore have yet another way to implement a replacement for BeanPropertySetterRule:

   digester.addCallMethod( "catalog/book/author", "setAuthor", 0 );

To call a method that truly takes no parameters, use digester.addCallMethod( "pattern", "methodName" );.

Creational

·         ObjectCreateRule: Creates an object of the specified class using its default constructor and pushes it onto the stack; it is popped when the element completes. The class to instantiate can be given through a class object or the fully-qualified class name.

·         FactoryCreateRule: Creates an object using a specified factory class and pushes it onto the stack. This can be useful for classes that do not provide a default constructor. The factory class must implement the org.apache.commons.digester.ObjectCreationFactory interface.

Property Setters

·         SetPropertiesRule: Sets one or several named properties in the top-level bean using the values of named XML element attributes. Attribute names and property names are passed to this rule in String[] arrays. (Typically used to handle XML constructs like <article page="10">.)

·         BeanPropertySetterRule: Sets a named property on the top-level bean to the character data enclosed by the current XML element. (Example: <page>10</page>.)

·         SetPropertyRule: Sets a property on the top-level bean. Both the property name, as well as the value to which this property will be set, are given as attributes to the current XML element. (Example: <article key="page" value="10" />.)

Parent/Child Management

·         SetNextRule: Pops the object on top of the stack and passes it to a named method on the object immediately below. Typically used to insert a completed bean into its parent.

·         SetTopRule: Passes the second-to-top object on the stack to the top-level object. This is useful if the child object exposes a setParent method, rather than the other way around.

·         SetRootRule: Calls a method on the object at the bottom of the stack, passing the object on top of the stack as argument.

Arbitrary Method Calls

·         CallMethodRule: Calls an arbitrary named method on the top-level bean. The method may take an arbitrary set of parameters. The values of the parameters are given by subsequent applications of the CallParamRule.

·         CallParamRule: Represents the value of a method parameter. The value of the parameter is either taken from a named XML element attribute, or from the raw character data enclosed by the current element. This rule requires that its position on the parameter list is specified by an integer index.

So far, we have specified the patterns and rules programmatically at compile time. While conceptually simple and straightforward, this feels a bit odd: the entire framework is about recognizing and handling structure and data at run time, but here we go fixing the behavior at compile time! Large numbers of fixed strings in source code typically indicate that something is being configured (rather than programmed), which could be (and probably should be) done at run time instead.

The org.apache.commons.digester.xmlrules package addresses this issue. It provides the DigesterLoader class, which reads the pattern/rule-pairs from an XML document and returns a digester already configured accordingly. The XML document configuring the Digester must comply with the digester-rules.dtd, which is part of the xmlrules package.

Below is the contents of the configuration file (named rules.xml) for the example application. I want to point out several things here.

Patterns can be specified in two different ways: either as attributes to each XML element representing a rule, or using the <pattern> element. The pattern defined by the latter is valid for all contained rule elements. Both ways can be mixed, and <pattern> elements can be nested -- in either case, the pattern defined by the child element is appended to the pattern defined in the enclosing <pattern> element.

The <alias> element is used with the <set-properties-rule> to map an XML attribute to a bean property.

Finally, using the current release of the Digester package, it is not possible to specify the BeanPropertySetterRule in the configuration file. Instead, we are using the CallMethodRule to achieve the same effect, as explained above.

<?xml version="1.0"?>

 

<digester-rules>

   <object-create-rule pattern="catalog" classname="Catalog" />

   <set-properties-rule pattern="catalog" >

      <alias attr-name="library" prop-name="library" />

   </set-properties-rule>

 

   <pattern value="catalog/book">

      <object-create-rule classname="Book" />

      <call-method-rule pattern="author" methodname="setAuthor"

                        paramcount="0" />

      <call-method-rule pattern="title" methodname="setTitle"

                        paramcount="0" />

      <set-next-rule methodname="addBook" />

   </pattern>

 

   <pattern value="catalog/magazine">

      <object-create-rule classname="Magazine" />

 

      <call-method-rule pattern="name" methodname="setName" paramcount="0" />

 

      <pattern value="article">

         <object-create-rule classname="Article" />

         <set-properties-rule>

            <alias attr-name="page" prop-name="page" />

         </set-properties-rule>   

         <call-method-rule pattern="headline" methodname="setHeadline"

                          paramcount="0" />

         <set-next-rule methodname="addArticle" />

      </pattern>

 

      <set-next-rule methodname="addMagazine" />

   </pattern>

</digester-rules>

Since all the actual work has now been delegated to the Digester and DigesterLoader classes, the driver class itself becomes trivially simple. To run it, specify the catalog document as the first command line argument, and the rules.xml file as the second. (Confusingly, the DigesterLoader will not read the rules.xml file from a File or an org.xml.sax.InputSource, but requires a URL -- the File reference in the code below is therefore transformed into an equivalent URL.)

import org.apache.commons.digester.*;

import org.apache.commons.digester.xmlrules.*;

 

import java.io.*;

import java.util.*;

 

public class XmlRulesDriver {

   public static void main( String[] args ) {

      try {

 

         File input = new File( args[0] );

         File rules = new File( args[1] );

 

         Digester digester = DigesterLoader.createDigester( rules.toURL() );

 

         Catalog catalog = (Catalog)digester.parse( input );

         System.out.println( catalog.toString() );

 

      } catch( Exception exc ) {

         exc.printStackTrace();

      }

   }

}

Conclusion

This concludes our brief overview of the Jakarta Commons Digester package. Of course, there is more. One topic ignored in this introduction are XML namespaces: Digester allows you to specify rules that only act on elements defined within a certain namespace.

We mentioned briefly the possibility of developing custom rules, by extending the Rule class. The Digester class exposes the customary push(), peek(), and pop() methods, giving the individual developer freedom to manipulate the parse stack directly.

Lastly, note that there is an additional package providing a Digester implementation which deals with RSS (Rich-Site-Summary)-formatted newsfeeds. The Javadoc tells the full story.

References

Philipp K. Janert, Ph.D. is a software project consultant, server programmer, and architect.


 

Apache Commons Digester 的使用 NULL 博文链接:https://longsy.iteye.com/blog/380360 立即下载

相关推荐

【rt-thread实战解析】从零到一:基于STM32与LAN8720A的以太网驱动配置全流程

本文详细解析了在RT-Thread操作系统上为STM32F407配置LAN8720A以太网驱动的全流程。从硬件连接自查、CubeMX工程创建、PHY复位函数编写,到RT-Thread工程配置、LwIP协议栈集成,最后进行实际上电测试与网络调试,手把手指导开发者避开常见陷阱,实现稳定的以太网连接。

m2n3b4v5c6的博客 529

Apache Commons Digester(Digester2.0)学习笔记

digester组件简化了xml文件处理操作,能将xml文件按照事先确定的规则(采用编码形式或xml配置文件形式),映射成java对象。digester组件现在最新版本是2.0,它所依赖的组件是:commons-logging(推荐1.1版本),BeanUtils(推荐1.8版本),还有需要jdk1.5.基本概念1. 在Digester的内部采用SAX来解析XML文件。为了能够正确的使用它,必须在

都市小混混 4471

低成本实现webhook接收端[python]

Webook本质上也是API,只不过是反向调用,即前端不主动发送请求,完全由后端推送。简单来说,Webhook是一个接受HTTP POST或是GET,PUT,DELETE的URL,一个实现了Webhook的API提供商就是在当事件发生的时候会向配置的URL发送信息,与请求-响应式不同,使用Webhook可以实时接收到变化。Ps:Webhook可能会发出大量的请求,确保接受的URL不被泄露或者应用能及时处理这些请求。

锡城小凯的博客 1万+

org.apache.commons.digester.Digester 解析 XML文件或者流

最近在做快捷支付这块,对XML这块接触的比较多.梳理XML这块的时候, 突然发现 Digester 对不管是 字符串的 XML 还是 XML文件都能很好的解析..不足点就是引用的 apache的东西有点多. (apache的东西 耦合性太高.....)不过确实好用..   首先是 import   import org.apache.commons.digester.Digester; ...

小科的奋斗 645

【校园网代理连接问题】已解决,“该设备或资源(Web 代理)未设置为接受端口“7890”上的连接“

我遇到这个问题很多次。每次都是vpn的问题,不止通俗意义上的梯子(clash之类的),还包括校园网vpn。点击“ 拨号和虚拟专用网络设置”中的“设置”, 关闭代理服务器。在打开vpn后或者关闭vpn后无法浏览网页,网页诊断显示“关闭“手动设置代理”中的“使用代理服务器”,关闭对应的本地代理即可。

聆雨。 1万+

Zabbix监控网络设备讲解

Zabbix监控网络设备讲解 本人在研究学习zabbix的时候,网上找过很多如何监控路由,交换,或者是防火墙的文章,但很多都比较散,这里我出一个大概的整合,方便大家参考和学习。本章就拿华三的交换机来做文章。 监控网络设备首先我们需要开启snmp协议,华三怎么开启snmp协议在我的博客里有写到,其次就是找到版本对应的OID,zabbix就是通过抓取设备的OID来做到监控网络设备的,当然zabbix也不仅仅只有通过snmp来监控设备,还有很多别的功能,这些功能我会在以后的博客里面一一更新 文章目录Zab

太阳了文哥的博客 3387

org.apache.commons.digester.Digester

http://baike.baidu.com/view/3602595.htm Digester本来仅仅是Jakarta Struts中的一个工具,用于处理struts-config.xml配置文件。显然,将XML文件转换成相应的Java对象是一项很通用的功能,这个工具理应具有更广泛的用途,所以很快它就在Jakarta Commons项目(用于提供可重用的Java组件库)中有了一席之地。

HkEndless的专栏 958

神州路由器DHCPv6配置

神州路由器DHCPv6配置.。

weixin_41687096的博客 466

学习一下org.apache.commons.digester.Digester

 The Example Document and BeansIn this example, we will unmarshall the same XML document that we used in the previous article:Author 1Title 1Author 2His One BookMag Title 1Some Headline

GetStudyMessages的专栏 8307

[DDR5]DDR5 SDRAM 状态图 和 基本功能

DDR5 SDRAM的读写操作以突发(burst mode)为导向,从选定的位置开始,并按照编程顺序进行16个突发长度或8个“切片”突发长度的操作。从ACTIVATE命令开始,然后是读取或写入命令。

串起点滴 1206

【AUTOSAR-IpduM】-3.1-配置一个发送Tx Dynamic Container PDU(Multiple-PDU)

手把手教您如何配置一个Tx Dynamic Container PDU(Multiple-PDU),动态容器复用帧。并附上测试LOG帮助您进一步加深理解。

「汽车电子助手」的博客 1778

java.lang.ClassNotFoundException: org.apache.commons.digester.RuleSet

使用velocity报找不到org.apache.commons.digester.RuleSet这个类,导入如下4个包还报这个错java.lang.ClassNotFoundException: org.apache.commons.digester.RuleSet 是因为配置文件中引用了toolbox 如图只要注销他就可以了 java.lang.ClassNotFound

mingtianhaiyouwo的博客 1886

Vue - 萤石云监控 ezuikit 视频实例销毁方案,解决使用stop方法无法销毁EZUIKit实例或销毁后依然占用内存并且监控画面依然有声音问题(解决页面多个监控摄像头画面同时播放,翻页或关闭页

vue2,vue3,萤石,监控摄像头,萤石云销毁视频实例,退出页面销毁,stop销毁原视频流,占用内存怎么办,销毁后视频依旧在后台播放有声音,销毁视频播放器,页面上有多个视频画面怎么销毁某一个,stop方法不生效怎么办,浏览器非常卡,dom销毁,ezuikit-js萤石云播放器Vue中使用beforeDestory销毁播放器实例,调用萤石云ezuikit-js的视频对象销毁,vue使用萤石云监控视频录像回放,不销毁实例会出现离开页面后依旧有监控声音并且占内存问题,不好使,页面崩了,崩溃,视频监控太多,没有用

🏆 前端领域优质创作者 1万+

org/apache/commons/digester/RuleSet

java.lang.NoClassDefFoundError: org/apache/commons/digester/RuleSet错误   解决办法是:加入commons-digester.jar包

xaiowen的专栏 289

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

org.apache.commons.digester 学习

org.apache.commons.digester软件包。以下网址有一个很不错的介绍: [@more@]http://www.onjava.com/pub/a/onjava/2002/10/23/digester.html?page=1 它能方便地将XML文档所定义的元素转化为JAVA对象 [code="java"] //生成一个digester。主要需要引进commo...

认真做每件事 183

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

org/apache/commons/digester/RuleSet 解决方法

java.lang.NoClassDefFoundError: org/apache/commons/digester/RuleSet解决方法   缺少这个包 commons-digester.jar  放到tommcat里的Lib 里即可 

ganlangreen的专栏 691

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

org.apache.commons.digester软件包学习

org.apache.commons.digester软件包学习 在毕业设计(基于XML的电子商务平台)的时候,我参考了几种处理XML文档的组件,DOM、JDOM等,最好我选择了用JDOM(当时感觉自己用的技术 比较先进)。但是在最近偶尔的机会见到了digester这个东西,感觉好奇所以今天学习了一 下:org.apache.commons.dig...

samson_g_q_su的博客 159

java中org.apache.commons.digester类用法

xml文件内容:   &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;channels&gt; &lt;channel switchTime="20080101000101" k="1.07" n="6" s="55" channelId="0404"

继中的专栏 235

JBOSS java.lang.NoClassDefFoundError: org/apache/commons/digester/RuleSet

经常在启动JBOSS的时候,发现在myeclipse的console中报错java.lang.NoClassDefFoundError: org/apache/commons/digester/RuleSet。 昨天工程不是还用的好好的,怎么这会会这样,后来一查都是说缺少了commons-digester.jar包,但是工程项目下明明有这个包。百思不得。 最后临时想到另外一个项目也用了JBOS...

weixin_33896726的博客 171

org.apache.commons.digester3.Digester(2)

要了解Digester如何处理众多rule,首先得知道他怎样处理xml的。Digester继承了DefaultHandler,使用sax的技术,所以他会先调用startDocument-->startElement-->endElement-->endDocument,当然如果有多个元素的话,会反复的调用startElement-->endElement直至元素遍历完成。 startDocume

310

org.apache.commons.digester.Digester学习

用于解析xml

chineselly的专栏 341
上一篇: 做算法处理:(MessageDigest)处理的步骤
下一篇: HTMLParser包的过滤分析
hjpengjava
博客等级 码龄18年 5粉丝 39原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址