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 Tom Wang <to...@panscopic.com> on 2003/01/07 20:23:16 UTC

XPath query problem

Hello,

I'm a new user to Xindice and I just installed the software.  I have an XML
doc looks like:

<root>
  <region name="East">
    <city name="Boston">
      <person>Roddick</person>
      <points>200</points>
      <dob>1.1.1980 10:10:10</dob>
    </city>
  </region>
</root>

I'm testing xpath query as:

xindice.bat xpath -c /db/test -q //region[@name]

Above query runs fine and returns the <region> element.  But if I change the
query to following then it doesn't work:

xindice.bat xpath -c /db/test -q //region[@name='East']

Can anyone tell me what the problem is?  Thanks for any advice!

-tom


RE: XPath query problem

Posted by Tom Wang <to...@panscopic.com>.
OK I got it.  The release notes says,

On Windows, command line queries can have problems with the 
quote handling of the windows shell. In general you should
put double quotes around the entire query string and use 
single quotes in your XPath. 

But it's not totally correct.  I changed my query to:

xindice.bat xpath -c /db/test -q "//region[@name='East']"

and it still doesn't work.  However, finally I found this working:

xindice.bat xpath -c /db/test -q "//region[@name=\"East\"]"

-tom

> -----Original Message-----
> From: Tom Wang [mailto:tomw@panscopic.com]
> Sent: Tuesday, January 07, 2003 11:23 AM
> To: xindice-users@xml.apache.org
> Cc: tomw@panscopic.com
> Subject: XPath query problem
> 
> 
> Hello,
> 
> I'm a new user to Xindice and I just installed the software.  I 
> have an XML
> doc looks like:
> 
> <root>
>   <region name="East">
>     <city name="Boston">
>       <person>Roddick</person>
>       <points>200</points>
>       <dob>1.1.1980 10:10:10</dob>
>     </city>
>   </region>
> </root>
> 
> I'm testing xpath query as:
> 
> xindice.bat xpath -c /db/test -q //region[@name]
> 
> Above query runs fine and returns the <region> element.  But if I 
> change the
> query to following then it doesn't work:
> 
> xindice.bat xpath -c /db/test -q //region[@name='East']
> 
> Can anyone tell me what the problem is?  Thanks for any advice!
> 
> -tom
> 
>