AnsweredAssumed Answered

Problem: XML tag value not right

Question asked by valfontanette on Jun 25, 2014
Latest reply on Jul 11, 2014 by valfontanette

I am having trouble to get the right content of a XML file. Just because the value of initial tags are not right.
Here is what I mean.

<?xml version="1.0" encoding="UTF-8"?>
<nfeProc xmlns="" versao="2.00">
   <NFe xmlns="">
      <infNFe versao="2.00" Id="NFe35140404108518000102550020000957691354988086">

I've used this to remove XML first line.

var content = new XML(node.content.replaceAll("(?s)<\\?xml .*?\\?>\\s*", ""));

It works fine.

Now I need to remove the "xmlns" values and the "versao="2.00"" from initial tags.
I need the tags to be like that:


I've tried a lot of things, but not have success.
The last one I have got somethig was that:

//Remove first line
document.content.replaceAll("(?s)<\\?xml .*?\\?>\\s*", "");
var fileContent = new XML(document);

//Remove nfeproc xmls
document.content.replaceAll("(?s)<\\?nfeProc xmlns .*?\\?>\\s*", "<nfeProc>");  //I got this result: <nfeProc versao="2.00">

//Remove nfe xmls
document.content.replaceAll("(?s)<\\?NFe xmlns .*?\\?>\\s*", "<NFe>"); //It works fine:  <NFe>

//Remove infNFe Id
document.content.replaceAll("(?s)<\\?infNFe Id .*?\\?>\\s*", "<infNFe>"); //Do not work

Any help??