hi henning

i've committed an adapted version of the patch you supplied. my version preserves the existing behaviour (for backwards compatibility) whilst also allowing the documented behaviour, please remember to supply a test case with any future next patches.

- robert

On Sunday, October 26, 2003, at 05:28 PM, Henning P. Schmiedehausen wrote:

According to the example in the xmlrules package-summary, adding a
programmatic rule to a XML digester rules file should work like this:

--- cut --
<digester-rules>
   <pattern value="root/foo">
     <include class="BarRuleCreator"/>
   </pattern>
 </digester-rules>
--- cut ---

--- cut ---
public class BarRuleCreator implements DigesterRulesSource {
    public void getRules(Digester digester) {
        digester.addObjectCreate("bar", "Bar");
    }
}
--- cut ---

In fact, it does not. One needs digester.addObjectCreate("/bar", "Bar");

because of this bug:

--- cut ---
Index: src/java/org/apache/commons/digester/xmlrules/DigesterRuleParser.java
===================================================================
RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/
digester/xmlrules/DigesterRuleParser.java,v
retrieving revision 1.20
diff -u -b -r1.20 DigesterRuleParser.java
--- src/java/org/apache/commons/digester/xmlrules/DigesterRuleParser.java 23 Oct 2003 20:06:09 -0000 1.20
+++ src/java/org/apache/commons/digester/xmlrules/DigesterRuleParser.java 26 Oct 2003 17:18:55 -0000
@@ -447,7 +447,7 @@
* pass through to this object.
*/
public RulesPrefixAdapter(String patternPrefix, Rules rules) {
- prefix = patternPrefix;
+ prefix = patternPrefix + "/";
delegate = rules;
}
--- cut ---


Please apply. Finding this cost me most of my sunday. :-)

        Regards
                Henning


-- Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH [EMAIL PROTECTED] +49 9131 50 654 0 http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development  -- hero for hire

"Dominate!! Dominate!! Eat your young and aggregate! I have grotty silicon!"
-- AOL CD when played backwards (User Friendly - 200-10-15)


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



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



Reply via email to