Hi everyone!
I have this VB.NET code for get data of an XML of an invoice:
Imports System.Xml
Private Function VarXml(ByRef xAtt As XmlElement, ByVal strVar As String) As String
VarXml = xAtt.GetAttribute(strVar)
If VarXml = Nothing Then VarXml = ""
End Function
Private Sub ExtraerVariables(ByVal strXML)
Dim xDoc As XmlDocument
Dim xNodo As XmlNodeList
Dim xAtt As XmlElement
Dim intConsecutivo As Integer
xDoc = New XmlDocument
xDoc.Load(strXML)
xNodo = xDoc.GetElementsByTagName("cfdi:Comprobante")
If xNodo.Count > 0 Then
For Each xAtt In xNodo
strTipoComprobante = VarXml(xAtt, "tipoDeComprobante")
strSerie = VarXml(xAtt, "serie")
strFolio = VarXml(xAtt, "folio")
strFechaEmision = VarXml(xAtt, "fecha")
strSello = VarXml(xAtt, "sello")
strNoCertificado = VarXml(xAtt, "noCertificado")
strSubtotal = VarXml(xAtt, "subTotal")
strTotal = VarXml(xAtt, "total")
strMoneda = VarXml(xAtt, "Moneda")
strCondiciones = VarXml(xAtt, "condicionesDePago")
strFormaPago = VarXml(xAtt, "formaDePago")
strMetodoPago = (VarXml(xAtt, "metodoDePago") + " " + VarXml(xAtt, "NumCtaPago")).Trim
strLugarExpedicion = VarXml(xAtt, "LugarExpedicion")
Next
End If
xNodo = xDoc.GetElementsByTagName("cfdi:Emisor")
If xNodo.Count > 0 Then
For Each xAtt In xNodo
strEmisorRfc = VarXml(xAtt, "rfc")
strEmisorNombre = VarXml(xAtt, "nombre")
Next
For Each xAtt In xNodo.Item(0)
If xAtt.LocalName Like "*DomicilioFiscal*" Then
strEmisorCalle = VarXml(xAtt, "calle")
strEmisorNoExterior = VarXml(xAtt, "noExterior")
strEmisorNoInterior = VarXml(xAtt, "noInterior")
strEmisorColonia = VarXml(xAtt, "colonia")
strEmisorReferencia = VarXml(xAtt, "referencia")
strEmisorMunicipio = VarXml(xAtt, "municipio")
strEmisorEstado = VarXml(xAtt, "estado")
strEmisorPais = VarXml(xAtt, "pais")
strEmisorCodigoPostal = VarXml(xAtt, "codigoPostal")
End If
If xAtt.LocalName Like "*RegimenFiscal*" Then
strRegimen = VarXml(xAtt, "Regimen")
End If
Next
End If
End Sub
Now the question is,exist something similar in Xojo to parse a XML File to get the Values for make a printer version of an Electronic Invoice?.
Is there a Class or something?
Thanks in advance