I need some help with opening xml files. The script I am writing has to get data from a couple of attributes in the xml files, currently my problem is that I receive two types of xml.
I do not know which type of xml I am receiving, and on opening the xml, if it is one of the types (version = 3.2) I can read it ok, but I don't seem to be able to open the other version to extract the data I need.
I am using _XMLDomWrapper, so far this is the code:
AutoIt
#include <_XMLDomWrapper.au3> $sXMLFile = "B22.xml" $result = _XMLFileOpen($sXMLFile, 'xmlns:cfdi="http://www.sat.gob.mx/cfd/3"') $version = _XMLGetAttrib("/cfdi:Comprobante", "version") $rfc = _XMLGetAttrib("/cfdi:Comprobante/cfdi:Emisor", "rfc") $raz = _XMLGetAttrib("/cfdi:Comprobante/cfdi:Emisor", "nombre") $objDoc = 0 $result = _XMLFileOpen($sXMLFile, 'xmlns="http://www.sat.gob.mx/cfd/2"') $version = _XMLGetAttrib("/Comprobante", "version") $rfc = _XMLGetAttrib("/Comprobante/Emisor", "rfc") $raz = _XMLGetAttrib("/Comprobante/Emisor", "nombre")
When I use it with file A32.xml it correctly displays the data, but when using file B22.xml I only get "-1"
Thanks in advance for your help