You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by wadi <co...@gmail.com> on 2010/06/08 16:58:29 UTC

[Digester] Creating a new XML rule

Hi,

I am trying to create a new rule, which can be defined in xml-rule file
also. The rule is extension to the existing call-param-rule in which we can
pass the constant parameters (mainly string constants) which is currently
not possible with the call-param-rule.
After googleing I found the steps to do it which are:


   - Update the DTD. You should add an element type for your rule. The
   element should have an attribute corresponding to each of the rule's
   initialization parameters.
   - Define an ObjectCreationFactory
   - Extend DigesterRuleParser , and override the addRuleInstances() method
   to add the rules for parsing your new element.

I did all the three steps but still I am not able to call the method with
string constants which I am defining in the rule-xml. I am getting the
values of parameter as null.

Attachments:
*digester-rules.dtd* (This is the updated dtd with the new element added as
call-constant-param-rule. So step 1 is done.
*UpdatedRuleParser.java* (This java file defines the ObjectCreationFactory
(ConstantParamRuleFactory) and also extends the DigesterRuleParser.
*_xelerator_config_rule.xml* (XML file which defines the digester rules).
*_xelerator_config.xml *(XML document which needs to be parsed).
*ConstantParamRule.java* (Extended rule file)

What is it which i am missing or doing wrong.

Thanks in advance.

--wadi