commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: Digester proposal/offer
Date Wed, 09 Apr 2003 17:14:12 GMT
hi chris

digester already has an xml-based way of representing digestion rules. 
could you outline the differences and advantages of your approach?

- robert

On Wednesday, April 9, 2003, at 06:05 PM, ck@newcity.com wrote:

> Currently the commons digester works by having a java programmer craft a 
> set of rules and bind them
> together within a java file that the digester then uses. I have found 
> that this is a very powerful
> way of working with xml and I have used this to great effect in a number 
> of projects.
>
> In the projects that I have used the digester in, I have usually found it 
> quicker and simpler to
> maintain and to use when the binding of the digester rules are not in 
> java code but instead in a
> text file that is loaded from the jar file. This makes the xml reader far 
> easier to read, and
> modify.. essentially its a lot easier and faster to work with.
>
>
> What I would like to know is whether anybody else would find such a way 
> of configuring an XML reader
> to be useful? And whether anybody in the digester team would support 
> adding it to the digester
> project?
>
> (which is another way of asking whether its worth my time to extract what 
> I've got from a project,
> clean it up a bit, maybe extend it a little and then submit it).
>
>
>
>
> An example of what I mean:
>
> Imagine the following XML,
>
> <A>
>   <B id="foo" age="1"/>
> </A>
>
>
> Rather than write java code to map the xml to digester rules, the 
> following text file would suffice:
>
>
> A     = new MyA()
> */B  = new MyB( @id )
> */B  = super.add( this )
> */B  = this.setAge( @age )
>
>
> These rules register digester rules in the order that they are specified 
> here.
>
> So.. when these rules see the XML above, an object called MyA is created 
> and then pushed onto the
> stack. When the B tag is reached, 3 rules will fire in order.. the first 
> creates the MyB object with
> the id attr passed as an argument to its constructor.  The second rule 
> calls the method add on MyA
> passing it the newly created MyB object... this and super refer to the 
> top stack element and the
> next element on the stack, respectively.   The last rule simply calls the 
> method setAge on the top
> object of the stack, passing it a single argument which is the age 
> attribute.
>
>
>
>
> - Chris.
>
>
> PS. What I have is very basic, it lacks decent logging (for debugging) 
> and doesn't support
> namespaces or conditional rules. However I've found it very useful in a 
> number of projects, and it
> can easily be extended if other people have the need.
>
>
>
>
> -------------------------------------------------
> Don't just tell them where you are. Tell them who you are.
> Free email at www.newcity.com.
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message