You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Boris Rousseau <br...@tssg.org> on 2003/09/23 15:52:00 UTC
Xpath inclusion operator
Hi,
I am trying to query a Xindice collection using an "and" operator.
However the following request does not work:
//AAA/BBB[text()='username'] | /CCC[text()='id']
here is an example xml doc:
<AAA>
<BBB> username<BBB/>
<CCC>id<CCC/>
...
</AAA>
<AAA>
<BBB> username2<BBB/>
<CCC>id2<CCC/>
...
</AAA>
The query retrieves every single <AAA> element, despite the fact that I want those that have the BBB element equal to username and the CCC element equal to id.
Can anyone please help?
Regards,
Boris
Re: Xpath inclusion operator
Posted by Boris Rousseau <br...@tssg.org>.
Hi again,
None of those actually give me any result.
Is there a particular syntax for Xindice?
If so, is there any reference guides for Xpath in Xindice?
Regards,
Boris
----- Original Message -----
From: Karol Hennessy
To: xindice-users@xml.apache.org
Sent: Tuesday, September 23, 2003 3:26 PM
Subject: Re: Xpath inclusion operator
What your asking won't work, the and/or operators can only go inside the "[ ]" as far as I know.
Something like this usually works for me
/AAA[BBB=\'username\' and CCC=\'id\']
or maybe this:
/AAA[BBB=\'username\' or CCC=\'id2\']
All the results have to have the same root node I think. That is, you can have some results starting <AAA>... and some <BBB>. They have to be one or the other. You may need two queries for what you want.
Karol.
On Tuesday, Sep 23, 2003, at 09:52 US/Eastern, Boris Rousseau wrote:
Hi,
I am trying to query a Xindice collection using an "and" operator.
However the following request does not work:
//AAA/BBB[text()='username'] | /CCC[text()='id']
here is an example xml doc:
<AAA>
<BBB> username<BBB/>
<CCC>id<CCC/>
...
</AAA>
<AAA>
<BBB> username2<BBB/>
<CCC>id2<CCC/>
...
</AAA>
The query retrieves every single <AAA> element, despite the fact that I want those that have the BBB element equal to username and the CCC element equal to id.
Can anyone please help?
Regards,
Boris
Re: Xpath inclusion operator
Posted by Karol Hennessy <ka...@physics.org>.
What your asking won't work, the and/or operators can only go inside
the "[ ]" as far as I know.
Something like this usually works for me
/AAA[BBB=\'username\' and CCC=\'id\']
or maybe this:
/AAA[BBB=\'username\' or CCC=\'id2\']
All the results have to have the same root node I think. That is, you
can have some results starting <AAA>... and some <BBB>. They have to
be one or the other. You may need two queries for what you want.
Karol.
On Tuesday, Sep 23, 2003, at 09:52 US/Eastern, Boris Rousseau wrote:
> Hi,
>
> I am trying to query a Xindice collection using an "and" operator.
> However the following request does not work:
> //AAA/BBB[text()='username'] | /CCC[text()='id']
>
> here is an example xml doc:
> <AAA>
> <BBB> username<BBB/>
> <CCC>id<CCC/>
> ...
> </AAA>
> <AAA>
> <BBB> username2<BBB/>
> <CCC>id2<CCC/>
> ...
> </AAA>
>
> The query retrieves every single <AAA> element, despite the fact that
> I want those that have the BBB element equal to username and the CCC
> element equal to id.
>
> Can anyone please help?
>
> Regards,
> Boris