Vigrond
Vigrond

Reputation: 8198

Why can't you query database paths/files using REST?

I have a database like so

<rest:databases xmlns:rest="http://basex.org/rest" 
                name="xml" 
                resources="1">
  <rest:resource type="xml" 
                 content-type="application/xml" 
                 size="33739"
    >path/test.xml</rest:resource>
</rest:databases>

Queries like /rest/xml?query=//element work

But

Queries like /rest/xml/path?query=//element do not

Nor do queries like /rest/xml/path/test.xml?query=//element

Both return an error:

[BXDB0005] Query must yield database nodes.

What am I misunderstanding about the architecture?

Upvotes: 0

Views: 201

Answers (1)

C. M. Sperberg-McQueen
C. M. Sperberg-McQueen

Reputation: 25054

The most obvious cause of a problem here is that your sample queries

/rest/xml/path?query=//element

and

/rest/xml/path/test.xml?query=//element

append the string '/path' to the database name; what is it doing there? You have shown us you have one document in the database 'xml', named 'test.xml'. You don't show us any documents name 'path'. I'd try

/rest/xml/text.xml?query=//element

Upvotes: 0

Related Questions