db:add or db:replace forget namespaces

Thursday, 18 September 2014 · 3 messages · last reply 19 Sep 2014
FE
Fabrice Etanchaud18 Sep 2014 23:32 #
Dear all @BaseX, in last snapshot, When adding/replacing a document with db:add/db:replace, If xml content is not a document-node, but an element, namespaces definitions are just forgotten in target document. The root element has a prefix, but no definition. Result is valid if you do not pass $xml but document { $xml } In the documentation, one can see that input can be a string (file path or serialized xml) or a document node. Maybe these functions could abort when an element is given ? Thank you for your fantastic tool ! Best regards,
CG
Christian Grün19 Sep 2014 00:17 #
Hi Fabrice,
Quoted text · Fabrice Etanchaud · 4 lines
> When adding/replacing a document with db:add/db:replace, > > If xml content is not a document-node, but an element, namespaces > definitions are just forgotten in target document.
Thanks for the information. The code for replacing documents has been changed just recently. I just tried to reproduce the described behavior, but did not succeed so far. The following bxs test script returns <x:a xmlns:x="x"/> as expected. Could you possibly modify it and send me a version that yields a wrong result?
<commands>
  <create-db name='db'/>
  <xquery><![CDATA[
    db:replace('db', 'a.xml', <x:a xmlns:x='x'/>)
  ]]></xquery>
  <xquery>.</xquery>
</commands>
Thanks, Christian
CG
Christian Grün19 Sep 2014 12:41 #
Quoted text · Christian Grün · 1 line
> The following bxs test script [...]
...does not necessarily require XML syntax. This here works as well:
create db db
xquery db:replace('db', 'a.xml', <x:a xmlns:x='x'/>)
xquery .

⚡Generated with XQuery