Alguém já conseguiu ler o XML da NF-e através de algum programa? Estou tentando mas só consigo ler o campo "versão" da tag "protNFe", preciso ler a chave e o número do protocolo. Li e reli a documentação de SAX e DOM mas até agora não tive sucesso. O XML é gerado pelo emissor gratuito da SEFAZ-SP. Obrigado Jorge Lapi
Rá! Consegui alguma coisa. Consigo obter o conteúdo que está dentro da tag, o valor ainda não. Código: define variable h-arquivo as handle. define variable h-elem-raiz as handle. define variable l-ok as logical. create x-document h-arquivo. create x-noderef h-elem-raiz. h-arquivo:load("file","c:\temp\nfe\nfe1.xml",false). h-arquivo:get-document-element(h-elem-raiz). run RetFilho(h-elem-raiz, 1). delete object h-arquivo. delete object h-elem-raiz. procedure RetFilho: define input parameter h-pai as handle. define input parameter i-nivel as integer. define variable i-cont as int. define variable h-filho as handle. create x-noderef h-filho. repeat i-cont = 1 to h-pai:num-children: l-ok = h-pai:get-child(h-filho, i-cont). if not l-ok then leave. if h-filho:subtype <> "element" then next. if h-filho:name = "NFe" then message h-filho:node-value " * " h-filho:get-attribute("xmlns") " * " h-filho:attribute-names view-as alert-box. run RetFilho(h-filho, (i-nivel + 1)). end. delete object h-filho. end procedure.
Olá Jorge. Voce não gostaria de avaliar o uso do StarWeb FrameWork. Entre outras coisas, ele possui recursos para ler e gerar XML, além de suporte a PDF para gerar Danfe. agnaldo@starweb-software.com.br MSN: starweb_software@hotmail.com Skype: starweb.software.