[xquery-talk] Linking Saxon through to exist database

Wolfgang wolfgang at exist-db.org
Sat Jan 24 13:35:49 PST 2009


>> You can access documents via HTTP using e.g.
>>
>> http://localhost:8080/exist/rest/db/test/a/books.xml
> 
> wget on http://localhost:8080/exist/rest/db/books/a works fine here.

Ok, but since books/a is a collection, you should get a collection listing:

<exist:collection name="/db/test/a" 
created="2009-01-24T13:29:17.92+01:00" owner="admin" group="dba" 
permissions="rwur-ur-u">
         <exist:resource name="books.xml" 
created="2009-01-24T13:29:17.965+01:00" 
last-modified="2009-01-24T13:29:17.965+01:00" owner="admin" group="dba" 
permissions="rwur-ur-u"/>
</exist:collection>

> Error
>   XPTY0019: Required item type of first operand of '/' is node();
> supplied value has item
>   type xs:string
> Static error(s) in query

You forgot to actually load the document using doc():

let $a := 'http://localhost:8080/exist/rest/db/test/a/books.xml'
return
<books>{
for $book in doc($a)//book
   return
   $book
}</books>

Wolfgang


More information about the talk mailing list