Hi Marc,
When I have the database closed in the GUI
base-uri(doc('F:/tmp/foo.xml')) => file:///F:/tmp/foo.xml
And when I open the database "foo" from the GUI
base-uri(doc('F:/tmp/foo.xml')) => /foo/foo.xml
Is that right?
I wouldn’t say so ;) As somewhat usual, I couldn’t reproduce it that easily. Could you possibly give me a step-by-step description how to proceed? Or ideally a command script that shows the behavior?
db:node-id($node)
should raise an error in case $node is not a database node.
We should possibly switch to another naming, because "database node" is not that appropriate (anymore). The background: We have two different XML node representations in BaseX. One is object-oriented, and it’s the format used for node constructors:
db:node-id(<x/>) → error db:node-id(element x { }) → error
It’s the most efficient solution for small XML fragments.
"Database nodes" are based on a compact representation, which we use for serializing databases to disk. It is also applied to keep larger fragments in main-memory, so it is used e.g. when calling functions like doc(), or the 'update' keyword:
db:node-id(doc('bla.xml')) → 0 db:node-id(<x/> update {}) → 0
Hope this helps, Christian