Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent xdmp:node-replace from adding a namespace declaration?

I want to use xdmp:node-replace to replace a node in my xml document. But, whenever it replaces a node it inserts a blank xmlns tag to that node. How to avoid it?

like image 627
Puneet Pant Avatar asked Aug 22 '26 04:08

Puneet Pant


1 Answers

A blank xmlns tag means that the default namespace is undeclared.

If the new node has no prefix and is in no namespace, and the parent node has a default namespace in its scope, this sounds like correct behavior, for example:

<parent xmlns="http://www.example.com/">
  <new-node xmlns=""/>
</parent>

Have you tried replacing with a node that is in the default namespace in scope for the parent? Then I would expect the following result (new-node is in the http://www.example.com/ namespace):

<parent xmlns="http://www.example.com/">
  <new-node/>
</parent>
like image 85
Ghislain Fourny Avatar answered Aug 24 '26 09:08

Ghislain Fourny



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!