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 pa...@extentis.com on 2003/05/21 03:10:33 UTC

no result while querying element attributes

I am using the addressbook example from the command line.
The following queries return results as expected:

xindice xpath -c /db/addressbook -q /person
xindice xpath -c /db/addressbook -q //address

But when I try restraining the selection based upon attribute value I get no
result, here is the query:

xindice xpath -c /db/addressbook -q //address[@type="home"]


The xml documents stored in the addressbook collection are the following:

<?xml version="1.0"?>
<person>
   <fname>John</fname>
   <lname>Smith</lname>
   <phone type="work">563-456-7890</phone>
   <phone type="home">534-567-8901</phone>  
   <email type="home">jsmith@somemail.com</email>
   <email type="work">john@lovesushi.com</email>
   <address type="home">34 S. Colon St.</address>
   <address type="work">9967 W. Shrimp Ave.</address>
</person>

<?xml version="1.0"?>
<person>
   <fname>SlackJawedLocal</fname>
   <lname>Cletus</lname>
   <phone type="work">123-456-7890</phone>
   <phone type="home">234-567-8901</phone>
   <phone type="cell">345-678-9012</phone>
   <email type="home">cletus@hotmail.com</email>
   <email type="work">cletus@micrsquish.com</email>
   <address type="home">1234 S. Elm St.</address>
   <address type="work">4567 W. Pine St.</address>
</person>

I would have expected to get two matched :

   <address type="home">34 S. Colon St.</address>
   <address type="home">1234 S. Elm St.</address>

I am quite new to both Xindice and Xpath so I might miss some evidence !

Any comment welcome, P. 

Re: no result while querying element attributes

Posted by Cédric Viaud <ce...@matrasi-tls.fr>.
You have to double-quote the queries :

xindice xpath -c /db/addressbook -q "//address[@type='home']"

Hope this helps,

   Cédric

----- Original Message -----
From: <pa...@extentis.com>
To: <xi...@xml.apache.org>
Sent: Wednesday, May 21, 2003 3:10 AM
Subject: no result while querying element attributes


>
> I am using the addressbook example from the command line.
> The following queries return results as expected:
>
> xindice xpath -c /db/addressbook -q /person
> xindice xpath -c /db/addressbook -q //address
>
> But when I try restraining the selection based upon attribute value I get
no
> result, here is the query:
>
> xindice xpath -c /db/addressbook -q //address[@type="home"]
>
>
> The xml documents stored in the addressbook collection are the following:
>
> <?xml version="1.0"?>
> <person>
>    <fname>John</fname>
>    <lname>Smith</lname>
>    <phone type="work">563-456-7890</phone>
>    <phone type="home">534-567-8901</phone>
>    <email type="home">jsmith@somemail.com</email>
>    <email type="work">john@lovesushi.com</email>
>    <address type="home">34 S. Colon St.</address>
>    <address type="work">9967 W. Shrimp Ave.</address>
> </person>
>
> <?xml version="1.0"?>
> <person>
>    <fname>SlackJawedLocal</fname>
>    <lname>Cletus</lname>
>    <phone type="work">123-456-7890</phone>
>    <phone type="home">234-567-8901</phone>
>    <phone type="cell">345-678-9012</phone>
>    <email type="home">cletus@hotmail.com</email>
>    <email type="work">cletus@micrsquish.com</email>
>    <address type="home">1234 S. Elm St.</address>
>    <address type="work">4567 W. Pine St.</address>
> </person>
>
> I would have expected to get two matched :
>
>    <address type="home">34 S. Colon St.</address>
>    <address type="home">1234 S. Elm St.</address>
>
> I am quite new to both Xindice and Xpath so I might miss some evidence !
>
> Any comment welcome, P.
>