06-25-2014 10:06 AM
<?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>
var content = new XML(node.content.replaceAll("(?s)<\\?xml .*?\\?>\\s*", ""));
<nfeProc>
<NFe>
<infNFe>
//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
07-22-2014 02:04 PM
logger.getSystem().out("####BEGIN ##### ");
var xml = new XML(document.content.replaceAll("(?s)<\\?xml .*?\\?>\\s*", ""));
default xml namespace="http://www.portalfiscal.inf.br/nfe"; //to solve xmls parameter
var nfe = xml.child(0);
var infNFe= nfe.child(0);
delete infNFe.@versao; // delete infNFe versao attribte
delete infNFe.@Id;
delete nfe.@xmlns;
delete xml.@versao;
delete xml.@xmlns;
logger.getSystem().out("#### XML CONTENT ##### " + xml);
var cnpj= xml.NFe.infNFe.dest.CNPJ;
var empresa= xml.NFe.infNFe.dest.xNome;
var competencia = xml.NFe.infNFe.ide.dEmi;
var cnpj_fornecedor = xml.NFe.infNFe.emit.CNPJ;
var fornecedor = xml.NFe.infNFe.emit.xNome;
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.