0
votes

I have a XML document and I need to replace

<json type="array">

for

<m:telemoveis xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:m="http://www.projetoPei.com/Main"
 xsi:schemaLocation="http://www.projetoPei.com/Main Main.xsd">

I tried the following FLOWER expression but the double quotes appear as &quote ; .What am I doing wrong? Also how can i use the value of new-name instead of m after the return?

for $x in doc('FnacData.xml')/json
let $new-name :=" m:telemoveis xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;xmlns:m=&quot;https://www.projetoPei.com/Main&quot;xsi:schemaLocation=&quot;https://www.projetoPei.com/Main Main.xsd&quot;"
return 
    element m   {

        $x/*
    }
1
Can you post an example of the desired output? I'm not quite sure that I understand what you are trying to achieve. Also, are you trying to persist this change in the database? - Mads Hansen

1 Answers

0
votes

Why you creating element in variable?

Can you smiply use like below:

for $x in doc('FnacData.xml')/json 
return 
<m:telemoveis xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://www.projetoPei.com/Main" xsi:schemaLocation="http://www.projetoPei.com/Main Main.xsd">
{$x}
</m:telemoveis>