commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Евгений Антаев <ant...@gmail.com>
Subject Re: Digester pattern with attribute
Date Thu, 05 Feb 2009 08:02:53 GMT
That's right. Thank you, Rahul

------
Evgeny

On Wed, Feb 4, 2009 at 10:35 PM, Rahul Akolkar <rahul.akolkar@gmail.com>wrote:

> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message