Hello
i'm trying to write a code that needs to create a xml like this:
Code:
<distDFeInt versao="1.00" xmlns="http://www.portalfiscal.inf.br/cte">
<tpAmb>1</tpAmb>
<cUFAutor>35</cUFAutor>
<CNPJ>99999999999999</CNPJ>
<consNSU>
<NSU>123456789012345</NSU>
</consNSU>
</distDFeInt>
i just try this way:
Code:
Get Create U_cXMLDOMDocument to hoXML
Set psDocumentName of hoXML to ((fMontaCaminhoXmlServico("E",0)) + "consulta_dfe.XML")
Get CreateDocumentElement of hoXML "distDFeInt" to hoRoot
Send AddAttribute of hoRoot "versao" "1.00"
Send AddAttribute of hoRoot "xmlns" "http://www.portalfiscal.inf.br/cte"
Send AddElement of hoRoot "tpAmb" "1"
Send AddElement of hoRoot "cUFAutor" "35"
Send AddElement of hoRoot "CNPJ" "99999999999999"
Get AddElement of hoRoot "consNSU" "" to hoconsNSU
Send AddElement of hoconsNSU "NSU" "123456789012345"
Get CreateChildProcessingInstruction of hoRoot "xml" 'version="1.0" encoding="UTF-8"' to hoRoot1
Get InsertBeforeNode of hoXML hoRoot1 hoRoot to hoRoot2
Get SaveXMLDocument of hoXML to bNotOk
the output is:
Code:
<distDFeInt xmlns="http://www.portalfiscal.inf.br/cte" versao="1.00">
<tpAmb xmlns="">1</tpAmb>
<cUFAutor xmlns="">35</cUFAutor>
<CNPJ xmlns="">99999999999999</CNPJ>
<consNSU xmlns="">
<NSU>123456789012345</NSU>
</consNSU>
</distDFeInt>
i dont want all tags with the attribute xmlns, what should i do for only the first one get the tag xmlns?
thank you