Another case related to XPath, but I am not sure it is related to the same
problem posted above.
I have a very small collection (only two documents). If I issue:
xindice xpath_query -c /db/testing -q /data
I got two records:
<data src:col="/db/testing" src:key="doc1"
xmlns:src="http://xml.apache.org/xindice/Query">
<test xmlns:src="http://xml.apache.org/xindice/Query">test data</test>
</data>
<data src:col="/db/testing" src:key="doc2"
xmlns:src="http://xml.apache.org/xindice/Query">
<test2 forTest2="1" xmlns:src="http://xml.apache.org/xindice/Query">test
data 2</test2>
</data>
However, if I change query to
xindice xpath_query -c /db/testing -q /data[1]
It still returned above two records. Shouldn't it only return one?
I also did test as
xindice xpath_query -c /db/testing -q /data/test2/forTest2
This time, there is no return. ???
If I try anything like
xindice xpath_query -c /db/testing -q /data[position() = '1']
or
xindice xpath_query -c /db/testing -q /data/test2[forTest2 = '1']
I will get error message:
ERROR : Query error: java.lang.Exception:
org.apache.xindice.core.query.CompilationException: Error
Compiling XPath
Expression
Does anybody have any idea where should I look into?
By the way, I am using 1.1b with Tomcat 4.1 on Win2K.
Lixin
-----Original Message-----
From: Todd Byrne [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 1:47 PM
To: [email protected]
Subject: Re: XPath problem
Hi Gul,
I ran your query from the command line on your sample document in a test
database and it only returned one record like I expected. Are you sure
this record isn't in more then one document or repeated in your
document?
here is the command I ran: xindice xpath -c /db/test -q
"//phonebook[name='Tom' or number='07989270142']"
and my output:
<?xml version="1.0"?>
<phonebook xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/test" src:key="test">
<name>Tom</name>
<number>07989270142</number>
</phonebook>
I am using version 1.0 still.
Maybe you can discribe your problem in a tad more depth and I would be
glad to continue to help.
Todd Byrne
On Thu, 2002-12-05 at 09:58, Gul Akbar wrote:
> Hello,
>
> I have this problem with my XPath Query.
>
> //phonebook[ name='Tom' or number='07989270142' ]
>
> This returns the same record twice, and I know that there is only one of
those
> records. The XML that is stored:
>
> <phonebook>
> <name>Tom</name>
> <number>07989270142</number>
> </phonebook>
>
> Can anyone please tell me why this record is being returned twice when I
use
> the boolean operator "OR" (shown in the XPATH above).
>
> Thanking you in advance
> Gul
>
> -------------------------------------------------
> This mail sent through IMP: webmail.brad.ac.uk