Hello
We are using BaseX6 to manage a local repository of XML artifacts
in a Java based application. We initially start with an empty collection, and
add documents as they are needed.
We have tried a number of approaches to this (more to come
on this in a separate email). One such approach is to insert the documents as
nodes into the container using XQuery. Example:
insert nodes document {<t:test xmlns:t='xyz'
xmlns:s='def'>good <s:test>bye</s:test></t:test>} into
collection('MyCollection')
It seems to me that only the first namespace declaration is
retrained.
If I follow this insertion with the following query:
declare namespace x ="xyz"; declare namespace
y ="def"; collection('MyCollection')/x:test
I get the following result:
<t:test xmlns:t="xyz">good <s:test
xmlns:s="">bye</s:test></t:test>
Notice that the namespace for the prefix s is now empty.
Further, if I reverse the order of the namespace
declarations in the insert query:
<t:test xmlns:s='def' xmlns:t='xyz'>good
<s:test>bye</s:test></t:test>
The query used above will not return a result (presumably
because the xyz namespace has been dropped).
Has anyone else encountered such issues? Currently we are
working around this by saving the XML content to a file and using the Add
process - which seems to work as expected. If possible, we would prefer to
avoid this extra step of saving the XML to a temporary file before adding it to
our BaseX database.
Thanks,
J Gager