On Wednesday, December 18, 2002, at 06:31 AM, James Bates wrote:
On Wednesday 18 December 2002 13:12, Vladimir R. Bossicard wrote:Kimbro StakenIt's far less fancy than discovering how Xindice works or integrating it
into the latest container server but I've finally decided -instead of -1
everything- to help the users and write an "embed driver tutorial".
And fix bugs along the way (it looks like we still have a few).
With the following code
String xpath_query = "//person[first='John']"; XPathQueryService xpath = (XPathQueryService) col.getService("XPathQueryService", "1.0"); ResourceSet resultSet = xpath.query(xpath_query);
ResourceIterator results = resultSet.getIterator(); Resource res = results.nextResource(); out.println("Result from the query:"); out.println(" content: " + res.getContent()); out.println(" id : " + res.getId());
the output is
Result from the query:
content: <person xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/example"
src:key="00000000485bce48000000f2314ce5a7"><first>John</ first><last>Doe</la
st><phone
type="home">555-123-456</phone><phone type="work">555-456-789</phone></person> id : null
Well, getId() returns null. I have almost no doubt that this is a bug but I am surprised the noone ever noticed it.
The problem is in
org.apache.client.xmldb.embed.CollectionImpl.query(), line 457. For some
reason XMLResourceImpl's make a distinction between "documentId" and simply
"Id". The above line sets id to NULL and documentId to the src:key attribute
of the result.
Exactly the same occurs with the XML-RPC driver in org.apache.client.xmldb.xmlrpc.CollectionImpl.query(), line 559.
We should try and find out why there are separate id's and documentId's...
James
-Vladimir
Java and XML Software, Consulting and Writing http://www.xmldatabases.org/
Apache Xindice native XML database http://xml.apache.org/xindice
XML:DB Initiative http://www.xmldb.org