I'm running a BaseX HTTP-Server where a read-only user is used for database queries.
Now I have the following document getDoc.xml to retrieve content of an XML file in the database:
<query>
<text><![CDATA[
let $doc := '/example.xml'
return doc($doc)
]]></text>
</query>
It is used via following curl-command:
curl -s --data-binary '@getDoc.xml' 'http://reader:readersPW@localhost:8080/rest'
which returns an error
[basex:permission] No create permission: doc("/example.xml")
Well, I understand that the doc() function creates an intermediate(?) document-node() and that my read-only user is not allowed to create something in database. Therefore this permission error arises.
However, I cannot believe that reading an XML document isn't possible for a read-only user. Well, he just wants to get an existing document printed.
Are there any other ways to read an XML file that work in milliseconds like doc() does?
There should be no need to upload a document with a query that points to your resource. Instead, you should be able to directly address it in your URL:
curl 'http://reader:readersPW@localhost:8080/rest/example.xml'