commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: Digester wildcard question
Date Tue, 21 Jun 2005 00:42:59 GMT
Thank you *very* much Simon, that was exactly what I needed!  I wound up 
using "config/?" as the pattern, and that did the trick perfectly, 
everything else worked as-is.

You know, Digester has always struck me as one of those things that is a 
  bit overwhelming for a while, but it really is one of the more 
powerful and useful Commons projects out there.

Thank again!


Simon Kitching wrote:
> On Mon, 2005-06-20 at 14:01 -0400, Frank W. Zammetti wrote:
>>Hi... I went through the Digester docs, but couldn't find the answer to my
>>specific question (although the answer seemed to be hinted at)... is it
>>possible to have a matching pattern of simply "*" so that every element in
>>the document being parsed fires the corresponding rule?
>>What I'm trying to do is have a simple XML format with a list of elements:
>> <item1>11</item1>
>> <item2>22</item2>
>> <item3>33</item3>
>>... and I want to have a rule fire to take each of those and insert them
>>in to a map (just a call to a generic setter), but without knowing
>>before-hand that item1, item2 and item3 will be present (i.e., maybe it's
>>item4, item5 and item6 instead).  So I figured just match "*" would do it,
>>but am looking for verification.  TIA!
> The standard rule-matching engine (RulesBase) doesn't support this. It
> allows leading wildcards (eg "*/item1"), but doesn't support a wildcard
> on its own.
> The ExtendedBaseRules class allows trailing wildcards, so "myDoc/*" will
> match any direct child element of myDoc which is what you want I
> believe. It also allows completely-wild expressions "*" and "!*". It
> doesn't have any expression to specify "any descendant of myDoc". See
> the javadoc for class ExtendedBaseRules for more info.
> The RegExRules class is even more powerful (but slower).
> There is a sneaky way of effectively supporting trailing-wildcard with
> the standard RulesBase matching engine if you are writing your own rule;
> the SetNestedElementRule class has an example of this. But
> ExtendedBaseRules is probably what you are looking for.
> Regards,
> Simon
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message