commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul Akolkar <rahul.akol...@gmail.com>
Subject Re: Digester pattern with attribute
Date Wed, 04 Feb 2009 19:35:10 GMT
On Wed, Feb 4, 2009 at 1:43 PM, Евгений Антаев <antaev@gmail.com> wrote:
> Hi
>
> Can I use attribute value as a constraint in a pattern for Digester?
>
> For example
>
> <addressBook>
>    ...
>    <contact>
>        <phone type='home'>00000000</phone>
>        <phone type='work'>99999999</phone>
>    </contact>
>    ...
> </addressBook>
>
> I would like to use pattern to match home phone only. Something like
> "contact/phone[@type='home']".
>
<snip/>

No. Commons Digester uses what it calls element matching patterns --
they aren't true XPath expressions so the example above can't be used
as intended (only element names are matched).

Short of defining your own digester Rule or Rules implementations,
perhaps you can simply ignore the bits you don't care about (so lets
say you use SetNextRule to add Phone objects to a Contact object, you
could ignore phones that aren't home phones).

-Rahul


> ------
> Evgeny
>
> Thanks
>

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


Mime
View raw message