You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Kim Ragna Mertens <ki...@mertens-nord.de> on 2013/02/11 12:59:39 UTC
[digester] wildcard in plugin rules
Hi,
I try to use digester to parse something like :
<ptwebltl>
<not><true/></not>
</ptwebltl>
I have created a plugin for ptwebltl, containing the following rules :
pattern = ptwebltl
d.addObjectCreate(pattern+"/*/true", TRUE.class); // (1)
d.addSetNext(pattern+"/*/true", addFormula);
d.addObjectCreate(pattern + "/true", TRUE.class); //(2)
d.addSetNext(pattern + "/true", addFormula);
d.addObjectCreate(pattern + "/not", NOT.class);
d.addSetNext(pattern + "/not", addFormula);
now I am able to parse with the (2) block something like
<ptwebltl>
<true/>
</ptwebltl>
but unfortunately the first rule block does not work, no rule is found
for the pattern ptwebltl/not/true
Is it possible to use wildcards in pluginrules ?
If I write a rule like d.addObjectCreate("*/true", TRUE.class) I got the
warning that a rule is specified that matches a pattern possible outside
the plugin scope,
If I do not use plugins, the rule work for creating a TRUE - Object
whenever it is read in the xml file.
How do I achieve the simular behavior in the plugin ?
Thanks
Lianna
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [digester] wildcard in plugin rules
Posted by Simone Tripodi <si...@apache.org>.
Hi Lianna,
please apologise for the late reply - I am quiet busy at work during
these months.
The sample you provided is not clear to me, there are details I can't
immagine how they are implemented, I suggest you anyway to have a look
at the TestCase implementation I gave for you[1], both tests pass now.
For patterns configurations I suggest you to have a look at the core document[2]
HTH, all the best!
-Simo
[1] https://gist.github.com/simonetripodi/5006064
[2] http://commons.apache.org/digester/guide/core.html
http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/
On Mon, Feb 11, 2013 at 12:59 PM, Kim Ragna Mertens
<ki...@mertens-nord.de> wrote:
> Hi,
>
> I try to use digester to parse something like :
>
> <ptwebltl>
> <not><true/></not>
> </ptwebltl>
>
>
> I have created a plugin for ptwebltl, containing the following rules :
>
> pattern = ptwebltl
>
> d.addObjectCreate(pattern+"/*/true", TRUE.class); // (1)
> d.addSetNext(pattern+"/*/true", addFormula);
>
> d.addObjectCreate(pattern + "/true", TRUE.class); //(2)
> d.addSetNext(pattern + "/true", addFormula);
>
> d.addObjectCreate(pattern + "/not", NOT.class);
> d.addSetNext(pattern + "/not", addFormula);
>
>
> now I am able to parse with the (2) block something like
>
> <ptwebltl>
> <true/>
> </ptwebltl>
>
> but unfortunately the first rule block does not work, no rule is found
> for the pattern ptwebltl/not/true
>
> Is it possible to use wildcards in pluginrules ?
> If I write a rule like d.addObjectCreate("*/true", TRUE.class) I got the
> warning that a rule is specified that matches a pattern possible outside
> the plugin scope,
> If I do not use plugins, the rule work for creating a TRUE - Object
> whenever it is read in the xml file.
>
> How do I achieve the simular behavior in the plugin ?
>
> Thanks
> Lianna
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org