commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <>
Subject Re: digester 2.0 [WAS Re: [digester] [PROPOSAL] More pattern matching flexibility]
Date Mon, 02 Sep 2002 22:06:02 GMT
On Monday, September 2, 2002, at 02:06 PM, Christopher Lenz wrote:


> My idea is to add a new class named (for example) DigesterContext to the 
> game, which would replace the pattern-String (and some more). In more 
> detail, it would:
>   - keep a stack of fully qualified names of the "open" elements,
>   - take over the bodyText stack that is currently directly in Digester,
>   - hold a reference to the Attributes of the current element.
> The Rules interface would have a method "match(DigesterContext context) - 
> List". Then, Rules implementations would have all the above information 
> (full stack of qualified names, current body text, current attributes) 
> available when performing the matching. There'd also need to be a way of 
> registering namespace URI / prefix pairs with the Rules implemention, say 
> "addNamespace(String prefix, String namespaceURI) - void".
> I'd also like to have access to the DigesterContext from the actual Rule.
>  That could of course be solved by adding an accessor to Digester itself,
>  although it would be cleaner to change the rule methods for a 2.0 
> release.

leaving aside the details, this is probably the way to go. it is more 
natural to have an DigesterContext object passed in as a parameter and it 
would mean that we shouldn't run into problems with expansion in the 
future. we should be able to make DigesterContext read only, maybe we 
should think about making Digester extend DigesterContext.

Rules is an interface but since it's poorly named anyway, we might 
actually think about creating a new 'Matcher' class. we could then retain 
backwards compatibility by using an adapter. we could use cristopher's 
nice strategy to retain compatibility for the rule class.

- robert

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

View raw message