[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

query on recursive xml structure

yix yix billigo at gmail.com
Tue Aug 29 14:57:42 PDT 2006


  query on recursive xml structure
Torsten,

thanks a lot

Billigo

On 8/29/06, Torsten Grust <http://x-query.com/mailman/listinfo/talk> wrote:
>
> Following up on myself, the slightly modified
>
>            //b[*/text()/tokenize(.," ") = ("kiwi","banana")]
>
> should be more stable with respect to spurious white space in the sub-
> trees below b elements.
>
>     --Torsten
>
> On Aug 29, 2006, 10:44 AM, Torsten Grust wrote with possible deletions:
> > Hi,
> >
> > does
> >
> >   //b[*/tokenize(.," ") = ("kiwi","banana")]
> >
> > solve your problem?  (It behaves as desired for the two cases you
> > give below.)
> >
> > Cheers,
> >    --Torsten
> >
> > On Aug 29, 2006, 10:18 AM, yix yix wrote with possible deletions:
> >> Hi,
> >>
> >>
> >> My input document looks like that :
> >>
> >> <a>
> >>     <b n="1">
> >>         <c>pea</c>
> >>         <d>apple</d>
> >>         <b n="2">
> >>             <c>kiwi</c>
> >>             <d>banana</d>
> >>         </b>
> >>     </b>
> >>     <b n="3">
> >>         <c>kiwi</c>
> >>         <d>banana</d>
> >>     </b>
> >> </a>
> >>
> >> The structure is recursive : b can contain b.
> >>
> >> I want to write a query to retrieve any b that contains "kiwi" and
> >> "banana", but I want to exclude the first b (with n="1") because
> >> the keywords are not in its own content (c+d), but in its b
> >> child's content.
> >> The query should return b2 and b3.
> >>
> >> This query can't go :
> >>
> >> for $x in //b
> >> where $x[contains(., "kiwi") and contains(., "banana")]
> >> and not($x/c[contains(., "kiwi") and contains(., "banana")])
> >> return     $x
> >>
> >> because, sometimes my put could be :
> >>
> >> <a>
> >>     <b n="1">
> >>         <c>pea</c>
> >>         <d>apple</d>
> >>         <b n="2">
> >>             <c>kiwi</c>
> >>             <d>banana</d>
> >>         </b>
> >>         <e>kiwi banana</e>
> >>     </b>
> >>     <b n="3">
> >>         <c>kiwi</c>
> >>         <d>banana</d>
> >>     </b>
> >> </a>
> >>
> >> In that case, the query should return all three b.
> >>
> >> Thanks for your help,
> >>
> >> Billig
> >> _______________________________________________
> >> http://x-query.com/mailman/listinfo/talk
> >> http://x-query.com/mailman/listinfo/talk
> >
> > --
> >   | Prof. Dr. Torsten Grust                         http://x-query.com/mailman/listinfo/talk |
> >   |                                 http://www-db.in.tum.de/~grust/ |
> >   |     Database Systems - Technische Universität München (Germany) |
> >
> >
> >
> >
> >
> > _______________________________________________
> > http://x-query.com/mailman/listinfo/talk
> > http://x-query.com/mailman/listinfo/talk
> >
>
> --
>    | Prof. Dr. Torsten Grust                         http://x-query.com/mailman/listinfo/talk |
>    |                                 http://www-db.in.tum.de/~grust/ |
>    |     Database Systems - Technische Universität München (Germany) |
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20060829/6856113c/attachment.htm


Purchase Stylus Studio Online Today!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.