gnre online

Delphi

21/10/2013

Pessoal estou montando o layout do gnre online em xml, estou usando o xmdocument, consegui gerar de 1 guia, porem nao estou conseguindo adicionar varias guias no mesmo arquivo xml, alguem saberia me ajudar com esse problema ?

Abs e obrigado
Felipe Ip

Felipe Ip

Curtidas 0

Respostas

Deivison Melo

Deivison Melo

21/10/2013

Seria interessante postar o sei código!

Abração e bons códigos!
GOSTEI 0
Felipe Ip

Felipe Ip

21/10/2013

      XMLDocument1.Active := False;
      XMLDocument1.XML.Clear;
      XMLDocument1.Options := [doNodeAutoIndent];
      XMLDocument1.Active := True;
      XMLDocument1.Encoding := 'UTF-8';
      XMLDocument1.Version  := '1.0';

      Root := XMLDocument1.addChild('TLote_GNRE');
      Root := Root.AddChild('guias');

      with Root.AddChild('TDadosGNRE') do
      begin
        AddChild('c01_UfFavorecida').NodeValue := estado;
        AddChild('c02_receita').NodeValue := '100099';
//      AddChild('c25_detalhamentoReceita').NodeValue := '';
//      AddChild('c26_produto').NodeValue := '';
        AddChild('c27_tipoIdentificacaoEmitente').NodeValue := 1;  

        with AddChild('c03_idContribuinteEmitente') do
        begin
          AddChild('CNPJ').NodeValue := cgc;
        end;

        AddChild('c28_tipoDocOrigem').NodeValue := 10;
        AddChild('c04_docOrigem').NodeValue := notas;
        AddChild('c06_valorPrincipal').NodeValue := valor;
//      AddChild('c10_valorTotal').NodeValue := valor;
        AddChild('c14_dataVencimento').NodeValue := vencimento;
//      AddChild('c15_convenio').NodeValue := '';
        AddChild('c16_razaoSocialEmitente').NodeValue := empresa
        AddChild('c17_inscricaoEstadualEmitente').NodeValue := inscricao
        AddChild('c18_enderecoEmitente').NodeValue := endereco;
        AddChild('c19_municipioEmitente').NodeValue := municipio;
        AddChild('c20_ufEnderecoEmitente').NodeValue := estadoempresa;
        AddChild('c21_cepEmitente').NodeValue := cep;
//      AddChild('c22_telefoneEmitente').NodeValue := telefone;
        AddChild('c34_tipoIdentificacaoDestinatario').NodeValue := 1;  

        with AddChild('c35_idContribuinteDestinatario') do
        begin
          AddChild('CNPJ').NodeValue := cgccliente;
        end;

        AddChild('c36_inscricaoEstadualDestinatario').NodeValue := inscricaocliente;
        AddChild('c37_razaoSocialDestinatario').NodeValue := cliente;
        AddChild('c38_municipioDestinatario').NodeValue := municipiocliente;
        AddChild('c33_dataPagamento').NodeValue := date();

        with AddChild('c05_referencia') do
        begin
//        AddChild('periodo').NodeValue := '';
          AddChild('mes').NodeValue := FormatDateTime('mm',date());
          AddChild('ano').NodeValue := FormatDateTime('yyyy',date());
//        AddChild('parcela').NodeValue := '';
        end;

       {with AddChild('c39_camposExtras') do
        begin
          with AddChild('campoExtra') do
          begin
            AddChild('codigo').NodeValue := '';
            AddChild('tipo').NodeValue := '';
            AddChild('valor').NodeValue := '';
          end;

          with AddChild('campoExtra') do
          begin
            AddChild('codigo').NodeValue := '';
            AddChild('tipo').NodeValue := '';
            AddChild('valor').NodeValue := '';
          end;

          with AddChild('campoExtra') do
          begin
            AddChild('codigo').NodeValue := '';
            AddChild('tipo').NodeValue := '';
            AddChild('valor').NodeValue := '';
          end;
        end;}

        AddChild('c42_identificadorGuia').NodeValue := nota;
      end;

      XMLDocument1.SaveToFile(GNRE.XML');


segue codigo q estou usando, coloquei esse codigo em um laço, porem quando passa pra o proximo registro e inicia o processo retorna o seguinte erro:
em um documento xml so sao permitidos elementos de nivel superior.

Abs e obrigado
GOSTEI 0
Felipe Ip

Felipe Ip

21/10/2013

sobe
GOSTEI 0
Everton Santos

Everton Santos

21/10/2013

bom dia, eu tbm to cm esse dilema, vc tem um xml de exemplo ?
eu qdo fiz na nota fiscal eletronica fiz na unha e nao usando xml document... se vc tiver um xml exemplo que eu tbm to precisando pra saber todos os nós (pois não sei interpretar o xsd e fazer por lá) aí vou fazer e tenho q fazer urgente e vamos tentanto junto q a gente consegue
caso eu consiga primeiro te mando a rotina em delphi.... só preciso do XML exemplo com os nós que precisa
GOSTEI 0
POSTAR