commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gogineni, Pratima" <pgogin...@selectica.com>
Subject RE: [digester] include in xmlrules
Date Wed, 16 Feb 2005 19:54:39 GMT
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
from:

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

To

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

Thanks
Pratima

-----Original Message-----
From: Gogineni, Pratima 
Sent: Wednesday, February 16, 2005 11:21 AM
To: 'Jakarta Commons Users List'
Subject: [digester] include in xmlrules


Hi,

I am trying to use include tag for programmatically creating rules in
xmlrules.

I see that my programatic rules are not matched even though the rule
executor was executed.

The below are the code snippets - am I doing something wrong?
XMLRules
<pattern value="a/b/c">
      <object-create-rule classname="ClassC" />
      <pattern value="d/e">
      	<object-create-rule classname="ClassE" />
		<include class="com.test.TestRuleCreator"/>
		<call-method-rule pattern="scriptname"
methodname="setScriptName" paramcount="0" />
        <call-method-rule pattern="functionname"
methodname="setFunctionName" paramcount="0" />
        <set-next-rule methodname="addClassE" />
      </pattern>      
      <set-next-rule methodname="setClassC" />
   </pattern>

Rule Creator
public void getRules(Digester digester) {
    	System.out.println("In  Rule Creator");
    	Rule rule = new CustomRule(digester);
    	digester.addRule("f", rule);
    	digester.addRule("f", new
SetNextRule(digester,"setScriptExtraInfo"));
    }
Config File
<a>
<b>
<c>
<d>
<e>
<scriptname>aName</scriptname>
<functionname>aName</functionname>
<f>
</f>
</e>
</d>
</c>
</b>
</a>

Thanks
Pratima

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message