Hi David,

On Tue, 2007-04-10 at 10:44 +0200, David Zarco wrote:
> We're trying to create a custom rule which will be used by Digester. We
> follow the steps indicated in
> http://jakarta.apache.org/commons/digester/commons-digester-1.8/docs/api/


> 
> but we had a problem with the inner class PatternRule of
> DigesterRuleParser. We overrided addRuleInstances(Digester digester)
> method but there was a compilation error because PatternRule is a
> private class


I haven't tried to do this myself; I prefer to use Digester via its API
rather than the xmlrules stuff. However from a look at the code I think
it's not a major problem.

I agree that PatternRule probably should not be private, so that it can
be reused. However it is a trivial class so I suggest you just
copy-and-paste it into your DigesterRuleParser subclass. Rename it to
something like MyPatternRule and then everything should be ok as far as
I can see.


All the PatternRule class is doing is pushing an object onto the
enclosing DigesterRuleParser instances' patternStack, and that *is*
protected scope so you do have access. I don't believe it matters
whether it is the original PatternRule or some variant that you create
that modifies the patternStack. And I think using "PatternRule" is
optional anyway; it only allows you to have a "pattern" attribute in
your new tag. As a pattern can also be defined via an enclosing pattern
element this is just a "nice-to-have".


> 
> Note: I'm sorry for my english

No problem. I'm struggling to learn German at the moment so have plenty
of sympathy for anyone struggling with a foreign language :-)

Regards,

Simon



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to