commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gogineni, Pratima" <>
Subject RE: [digester] include in xmlrules
Date Tue, 22 Feb 2005 22:55:24 GMT

Sorry for the delayed response (long weekend).

I have retested this and I do find that addRule("f",rule) does NOT work for
me. Im looking at the code and yes I see a ruleprefixadaptor and I cant find
anything wrong with the code so not sure why its not prepending "/" - Ill
check this in a debugger later today.

-----Original Message-----
From: Simon Kitching []
Sent: Wednesday, February 16, 2005 9:58 PM
To: Jakarta Commons Users List
Subject: RE: [digester] include in xmlrules

On Wed, 2005-02-16 at 11:54 -0800, Gogineni, Pratima wrote:
> On examining the stack I think I found the problem:
> In my rule creator:  digester.addRule("f", rule); should actually be
> digester.addRule("/f", rule);
> i.e. I need to have the path separator as well.
> Which means the Example given in the JavaDoc also needs to be corrected

Could you please confirm this? It sure looks to me like the javadoc
correctly reflects what the code is doing.

DigesterRuleParser has a nested class RulesPrefixAdapter, which is the
object that the custom addRules method actually adds its rules to. This
class overrides the Rules.add method to transparently prepend the
current match prefix when rules are added. And this method does:

        public void add(String pattern, Rule rule) {
            StringBuffer buffer = new StringBuffer();
            if (!pattern.startsWith("/")) {
            delegate.add(buffer.toString(), rule);

So in your example, it looks to me like the rule is added with a pattern
regardless of whether you call
   digester.addRule("f", ...);
   digester.addRule("/f", ...);



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

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

View raw message