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 arjen stolk <as...@topshare.com> on 2002/07/29 17:23:55 UTC

xpath query to retrieve document with specific src:key

hello,

i'm trying to retrieve documents by id.
the problem is that the query doesn't return a result.

code snippet:

XPathQueryService service = (XPathQueryService) col.getService("XPathQueryService", "1.0");
service.setNamespace("src", "http://xml.apache.org/xindice/Query");
 resultSet = service.query("/person[@src:key='1100a7c01f9fdabb000000ef519d496a']"); 
           
 document:

          <person xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/addressbook" src:key="1100a7c01f9fdabb000000ef519d496a"><name>klaas</name><address>hiero</address></person>

(this is to show that i cut and pasted the src:key ok)



what can i do to make this work?
is it somehow possible to retrieve a document by id?


regards, arjen stolk


Re: xpath query to retrieve document with specific src:key

Posted by Lukasz Kowalczyk <lu...@jazzpolice.pl>.
Monday, July 29, 2002, 5:23:55 PM, you wrote:

as> hello,

as> i'm trying to retrieve documents by id.

Use XPathQueryService.queryResource() although for this specific query
which, I suppose, is simplified it would be enough to retrieve the
document with Collection.getResource()

-- 
Lukasz Kowalczyk


Re: xpath query to retrieve document with specific src:key

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
ResourceSet resultSet = service.queryResource(id, xpath);

Jeff
  ----- Original Message ----- 
  From: arjen stolk 
  To: xindice-users@xml.apache.org 
  Sent: Monday, July 29, 2002 8:23 AM
  Subject: xpath query to retrieve document with specific src:key


  hello,

  i'm trying to retrieve documents by id.
  the problem is that the query doesn't return a result.

  code snippet:

  XPathQueryService service = (XPathQueryService) col.getService("XPathQueryService", "1.0");
  service.setNamespace("src", "http://xml.apache.org/xindice/Query");
   resultSet = service.query("/person[@src:key='1100a7c01f9fdabb000000ef519d496a']"); 
             
   document:

            <person xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/addressbook" src:key="1100a7c01f9fdabb000000ef519d496a"><name>klaas</name><address>hiero</address></person>

  (this is to show that i cut and pasted the src:key ok)



  what can i do to make this work?
  is it somehow possible to retrieve a document by id?


  regards, arjen stolk