You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Christopher Lenz <cm...@gmx.de> on 2002/09/11 13:28:35 UTC

[digester] [PATCH] Passing namespace URI and name to the Rule methods

Hi all,

[this stuff has been discussed before, and here I'm sending a patch to 
push a little ;-)]

The intention of the changes in this patch is to:

  (a) enable processing of namespace information by Rule implementations,
      and
  (b) improve the way Rule implementations get access to the name of the
      matching element

In my opinion, these changes are long overdue, at least since the 
introduction of the ExtendedBaseRules class, but are quite useful even 
when not using that Rules implementation. You'll find an example in a 
second patch that I'm going to send out a bit later. Also, you may want 
to read this message and the associated thread:

http://nagoya.apache.org/eyebrowse/ReadMsg?listName=commons-user@jakarta.apache.org&msgNo=410

Anyway, the approach chosen by this patch is as follows:
the three methods
   Rule.begin(Attributes attributes)
   Rule.body(String text)
   Rule.end()
are deprecated, and new variants of those methods are added to the Rule 
class:
   Rule.begin(String namespaceURI, String name, Attributes attributes)
   Rule.body(String namespaceURI, String name, String text)
   Rule.end(String namespaceURI, String name)

The default implementation of those new methods delegate to the 
deprecated variant, so that *full backward compatibility* can be 
accomplished.

In the patch, Digester is modified so that it calls the new methods, and 
BeanPropertySetterRule is updated to take advantage of the new methods 
(it needs access to the element name). All other Rule implementations 
are left unchanged, mainly to demonstrate that (let me repeat ;-)) *full 
backwards compatibility* is retained.

Please comment or commit ;-)

-- 
Christopher Lenz
/=/ cmlenz at gmx.de