Jump to content
Fivewin Brasil

TXmlDocument (resolvido)


emotta

Recommended Posts

veja se ajuda

     cFile := FOpen( "arquivo.xml" )
     xmlDoc := TXmlDocument():New( cFile )
     If xmlDoc:nStatus != HBXML_STATUS_OK
        Msginfo("Erro ao ler XML", "Aviso!")
        Return nil
     Endif
     xmlIter := TXmlIterator():New( xmlDoc:oRoot )
     xmlNode := xmlIter:Find()

     Do While xmlNode != nil
        If !Empty(xmlNode:cData)
           If Lower(xmlNode:cName) == "nnf"
              cNumeroNFe := xmlNode:cData
           Elseif Lower(xmlNode:cName) == "cfop"
              cCFOP := xmlNode:cData
           Elseif Lower(xmlNode:cName) == "chnfe"
              cChaveNfe := xmlNode:cData
           Endif
        Endif
        xmlNode := xmlIter:Next()
     Enddo
  Endif

 ? cChaveNfe

 

Link to comment
Share on other sites

Faça assim:

cFile := FOpen( "arquivo.xml" )
     xmlDoc := TXmlDocument():New( cFile )
     If xmlDoc:nStatus != HBXML_STATUS_OK
        Msginfo("Erro ao ler XML", "Aviso!")
        Return nil
     Endif

oNode := xmlDoc:findfirst("chNFe")

If oNode != Nil

  ?oNode:cData

Endif

 

Edited by crisvam
Auxilio
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...