HII 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="http://www.portalfiscal.inf.br/nfe" versao="2.00">
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
<infNFe versao="2.00" Id="NFe35140404108518000102550020000957691354988086">
<ide>
…
</ide>
…
</infNFe>
…
</NFe>
…
</nfeProc>
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:
<nfeProc>
<NFe>
<infNFe>
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??