This is related to an older open issue on GitHub [1]; I hope I can fix it with BaseX 10.
Best, Christian
[1] https://github.com/BaseXdb/basex/issues/1172
Eliot Kimber eliot.kimber@servicenow.com schrieb am Fr., 4. Feb. 2022, 01:54:
I think this is a bug:
I’m using db:create() to initialize a database with files from the file system. The OS is linux (but I see the same issue with macOS).
The docs all load without error, but then when processing the loaded content with code that uses base-uri() to get the base URI of a document, I get this failure:
*URI '/rome/product/human-resources/task/predict-assignment-group[1].dita' is invalid*
Which is correct—the square brackets must be escaped.
However, I didn’t create the URI, BaseX did when it loaded the data, which suggests that there’s a URI escaping action that isn’t being performed when the data is loaded: I would expect the URI to be “ *predict-assignment-group%5B1%5D.dita”* as returned by base-uri() (and as stored in the <resource> entry for the document).
If I do:
collection('/rome/product/human-resources/task/predict-assignment-group[1].dita')/*
I also get i*nvalid collection URI: '/rome/product/human-resources/task/predict-assignment-*group[1].dita'
Using db:dir to examine the <resource> entry for the file I see:
<resource raw="false" content-type="application/xml" modified-date="2022-02-03T22:44:29.107Z">predict-assignment-group[1].dita</resource>
So the brackets are not escaped there.
I can use the db:* functions to correct the paths (or just delete the nodes) so not a hard-stop problem.
Cheers,
E.
*Eliot Kimber*
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com https://www.servicenow.com
LinkedIn https://www.linkedin.com/company/servicenow | Twitter https://twitter.com/servicenow | YouTube https://www.youtube.com/user/servicenowinc | Facebook https://www.facebook.com/servicenow