Hi All,

I tried to use Xpath to query the database but with no result output, my case 
is:

-CVS of Xindice with Tomcat  http://localhost:8080/Xindice with debug tools 
works
-Linux
-command line can add or list collection with "xindice lc -c /db"

With subcollection test in db such that /db/test
and documents test1.xml and test2.xml

test1.xml

<?xml version="1.0"?>
<person>
   <fname>John</fname>
   <lname>Smith</lname>   
   <age>30</age>
</person>

test2.xml

<?xml version="1.0"?>
<person>
   <fname>Paul</fname>
   <lname>Tokon</lname>   
   <age>30</age>
</person>


When I run xpath as follows

xindice xpath -v -c /db/test -q /person[fname="*"]

it returns the follows

<person xmlns:src="http://xml.apache.org/xindice/Query"; src:col="/db/test" 
src:key="test1">
   <fname xmlns:src="http://xml.apache.org/xindice/Query";>John</fname>
   <lname xmlns:src="http://xml.apache.org/xindice/Query";>Smith</lname>
   <age xmlns:src="http://xml.apache.org/xindice/Query";>30</age>
</person>
<person xmlns:src="http://xml.apache.org/xindice/Query"; src:col="/db/test" 
src:key="test2">
   <fname xmlns:src="http://xml.apache.org/xindice/Query";>Paul</fname>
   <lname xmlns:src="http://xml.apache.org/xindice/Query";>Tokon</lname>
   <age xmlns:src="http://xml.apache.org/xindice/Query";>30</age>
</person>


However, when I run 
xindice xpath -v -c /db/test -q /person[fname="Paul"]

it return nothing, is there any wrong with me???

Thanks for any help.


Regards,

Trevor





-----Original Message-----
From: Paul Brown [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 08, 2003 7:05 AM
To: [email protected]
Subject: Xpath query not working, me confused...!



I'm using the query:
        "//enaml/header/date/text()"
To try and retrieve all the text() nodes of the 'date' element from
within a collection of 'enaml' documents, where <enaml> is the root
element of each document.

However the query returns no values into:

        ResourceSet resultSet = service.query(xpathValue);

i.e. resultSet.getSize() == 0.

But the query:
        "//enaml/header/date/." 
works, but returns a <date> node instead of the text() sub-node of that
<date>.

Where am I going wrong?

Cheers

Paul

Reply via email to