commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <>
Subject New sandbox component: at-digester
Date Wed, 06 Jan 2010 12:38:50 GMT
Hi all guys
As a new ASF committer, I'm setting up a new Commons Sandbox, called "@Digester"


The Apache commons-digester[1] is a great, light and fast XML parser;
it works with the SAX APIs and provides a serie of facilities to map
It's configurable in the following ways:
* instancing and registering digester's rules into the digester;
* using the shorthand registration methods
* XML digester rules.

Even if these methods are excellent, they are limited - if Java
objects are due to be changed quickly, all previous methods need to be

Inspired by the basic idea behind the JPA, JAXB's specifications, the
digester-annotations package would add some facilities to configure
the commons-digester using the Java5 language metadata annotations
support, it means creating the digester ruleset introspecting the
target POJOs, using a provided set of annotations. Using the annotated
Java object it's possible to create, in runtime the digester parser,
avoiding manual updates.

I mean, for example, given the following XML snippet


It could be mapped as

public final class ServletBean {

   private String servletName;

   private String servletClass;

   private final Map<String, String> initParams = new HashMap<String,

   public String getServletName() {
       return this.servletName;

   public void setServletName(String servletName) {
       this.servletName = servletName;

   public String getServletClass() {
       return this.servletClass;

   public void setServletClass(String servletClass) {
       this.servletClass = servletClass;

   public void
String name,
           @CallParam("web-app/servlet/init-param/param-value") String value) {
       this.initParams.put(name, value);



and a special DigesterLoader is able to create Digester rules simply
by analizing the ServletBean class:

Digester digester = DigesterLoader.createDigester(ServletBean.class);

Of course, this approach has limitations too - i.e. it doesn't work
with 3rd part developed objects - but the combined use of the
different approaches should reduce the manually produced code.

Current status of code:
I've already done almoust the 80% of code on google-code[2] licensed
under ASF2 license and also submitted a deprecated patch[3] on
commons-digester Jira: I would like to remove the
project on google-code and complete the work in
the sandbox, then re-propose to commons-digester community the new

I really hope you'll find this new way of parsing XML interesting like I do :P
Thanks in advance, best regards!!!
Simone Tripodi



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message