terça-feira, 5 de julho de 2016

Curso WinDev - Xml - 004 - Ler xml Aula 3/...









Nessa aula vou mostrar como ler um xml

This lesson will show how to read a xml

Cette leçon montre comment lire un xml


Video youtube



WinDev - Xml - 001/... Criar um Xml
WinDev - Xml - 002/... Ler Xml Aula 1/...
WinDev - Xml - 003/... Ler Xml Aula 2/...
WinDev - Xml - 004/... Ler Xml Aula 3
WinDev - Xml - 005/... XmlRead - Retirar Tag
WinDev - Xml - 006/... Sefaz Gratuito-Ler Xml Cliente/Gravar



Tag Retirar - XmlRead - WinDev - Xml - 005/...
WinDev - Xml - 001/... Criar um Xml
WinDev - Xml - 002/... Ler Xml Aula 1/...
WinDev - Xml - 003/... Ler Xml Aula 2/...
WinDev - Xml - 004/... Ler Xml Aula 3
Sefaz Gratuito-Ler Xml Cliente/Gravar - WinDev - Xml - 006/...




//("xml","/nfeProc/protNFe/infProt/chNFe")
//("xml","/nfeProc/NFe/infNFe/ide/nNF")
//fazer a pesquisa e mostrar // do research and show //  faire des recherches et spectacle

EDT_ChaveNota=pesquisa("chNFe",EDT_xml)
EDT_numero_nota=pesquisa("nNF",EDT_xml)


//vou fazer uma procedure interna pesquisa tag // i will make an internal tag search procedure
// je vais faire une procédure tag de recherche interne

    INTERNAL PROCEDURE pesquisa(_recebe_tag,_recebe_arquivo_xml)
       //vou criar string texto inicial e final //i will create string start and ent text
       //je vais créer début de chaîne et le texte final
       _texto_inicial is string="<"+_recebe_tag+">"
       _texto_final is string="</"+_recebe_tag+">"
       //criar uma posicao inicial e final //create an initital and final position //créer une position initiale et finale
       _posicao_inicial is int=0
       _posicao_final is int=0
       //vou pegar a posição inicial // i´ll get the startion position //je vais prendre la position de départ
       _posicao_inicial=PositionOccurrence(_recebe_arquivo_xml,_texto_inicial,firstRank,FromBeginning)+Length(_texto_inicial)
       //vou pegar a posição final // i´ll get the final position // je vais prendre la position finale
       _posicao_final=PositionOccurrence(_recebe_arquivo_xml,_texto_final,firstRank,FromBeginning)
       //vou verificar se posição final maior inicial // i will check if initial higher end position // je vais vérifieir si la position iniale de haut de gamme
       IF _posicao_final>_posicao_inicial THEN
                //vou pegar o conteudo da tag // i´ll take the content of the tag   //je vais prendrer le contenu de la balise
                RESULT Middle(_recebe_arquivo_xml,_posicao_inicial,_posicao_final-_posicao_inicial)
           ELSE
                RESULT ""
           END
          
    END
   























Teste

Teste
teste