You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by sky Chen <sk...@gmail.com> on 2015/03/01 12:54:57 UTC

Fwd: [digester] declare plugin in xml rule file

There is nothing like Plugin-create-rule in digester-rules.dtd. The doc
says a class used as a plugin may dynamically add its own rules to the
digester by providing an xmlrules file which defines the associated parsing
rules. But there is no example showing how to define "associated parsing
rules".

Suppose I want to create an instance of plugin "SteelBar" which implements
"Bar" interface with this config.xml:

<foo>
   <plugin id="SteelBar" class="SteelBar" />

   <bar plugin-id="SteelBar" name="spam"/>
</foo>


I would like to write my rule.xml as:

<digester-rules>
    <pattern value="foo">
         <object-create-rule classname="Foo"/>
         <set-properties-rule/>

        <pattern value="bar">
            <plugin-create-rule classname="Bar"
include="SteelBar_rule.xml"/>
            <set-next-rule methodname="addBar"/>
        </pattern>
    </pattern>
</digester-rules>

Without "plugin-create-rule" in dtd, how could I archive this?