You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Graham Lea <Gr...@forge.com.au> on 2003/03/26 06:26:50 UTC

Questions on Namespace-aware Rules

Greetings.

I'm trying to upgrade to Digester 1.4.1 from 1.3 and have two questions 
on Namespace-aware rules:

One: Why have the non-namespace aware methods in Rule been deprecated?
It would seem the rationale here is to force all Rules to be 
namespace-aware, but isn't it possible that some may not need to be?

Two: I have custom rules that now implement deprecated methods. (Don't 
worry, I'm not angry - it happens.)
However, I have no idea how to write a namespace-aware Rule.
I had a cursory look at some of the Rules included in the distribution: 
BeanPropertySetterRule has the new arguments but never uses them, while 
CallMethodRule still implements the deprecated API!

I'm just wondering if someone could tell me either:
(a) how to implement namespace-aware rules or
(b) that I don't have to if I don't want to, and that it's enough to 
just add the new parameters and ignore them.

Thanks,

Graham.

-- 
Graham Lea
Software Engineer
Forge Research Pty Ltd
Suite G11, Bay 9, Locomotive Workshop
Australian Technology Park, Cornwallis Street
Eveleigh NSW 1430 Australia
Phone: +61 2 9209 4152   Fax: +61 2 9209 4172
www.forge.com.au
----------------------------------------------------------------------
This message contains privileged and confidential information intended
only for the use of the addressee named above.  If you are not the
intended recipient of this message you must not disseminate, copy or
take any action in reliance on it.  If you have received this message
in error please notify the sender immediately.  Any views expressed in
this message are those of the individual sender, except where the
sender specifically states them to be the views of another (including
a Body Corporate).
----------------------------------------------------------------------



Re: Questions on Namespace-aware Rules

Posted by Simon Kitching <si...@ecnetwork.co.nz>.
On Wed, 2003-03-26 at 17:26, Graham Lea wrote:

> One: Why have the non-namespace aware methods in Rule been deprecated?

Well, technically the difference between the old and new begin/body/end
methods is not namespaces, but the fact that information about the name
of the current element is now provided to these methods. The name of an
element  of course is in two parts: the namespace and the element's
"local" name.

> (b) that I don't have to if I don't want to, and that it's enough to 
> just add the new parameters and ignore them.

Yep. Just changing the prototype of your existing rules' begin and end
methods should be all that is needed. Most rules don't care what the
current node's name is when triggered, but I believe someone had a
reason for requesting this a few months ago.


As an aside, the namespace handling in the pattern-matching is pretty
hacky, but very fast; it gives only some of the benefits of proper
namespace handling, but does it for almost no performance hit.

Cheers,

Simon