Lectura de archivos XML

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Lectura de archivos XML

Post by andyglezl »

Hola
Estoy empezando a ver el tema de poder leer un archivo XML de la factura electrónica acá en México,
alguna pista o ejemplo por donde empezar ???
Gracias.
------------------------------------------------------------------------------------------------------------------------------
Hello
I'm starting to see the issue of being able to read an XML file from the electronic invoice here in Mexico,
Some clue or example where to start???
Thank you.
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Lectura de archivos XML

Post by dragancesu »

XML Is text file, easy for read, but interpreting content maybe not. Can you upload example XML?

Download program xmlpad and read XML, you can see structure, logical part of it
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Lectura de archivos XML

Post by andyglezl »

Gracias dragancesu por contestar.

Quiero ampliar la necesidad que tengo (a grandes rasgos).
Necesito leer uno o varios archivos XML con filtros de diferentes valores que existan en ellos,
y emitir una serie de reportes o exportar a Excel cierta información. (por supuesto, en HMG)
Según leí, necesito leer cada TAG y obtener su valor

Anexo un ejemplo de un archivo XML.
(parece que la extención XML da problemas, lo envío como .rar )

-------------------------------------------------------------------------------------------------------------------------------
Thanks Dragancesu for answering.

I want to expand the need that I have (roughly).
I need to read one or more XML files with filters of different values that exist,
and issue a series of reports or export some information to Excel. (Of course, in HMG)
As I read, I need to read each TAG and get its value

An example of an XML file is attached.
(It seems that the XML extension gives problems, I send it as. rar)

Muestra XML.rar
(2.78 KiB) Downloaded 169 times
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Lectura de archivos XML

Post by dragancesu »

XML can contain many logical units as in this case
but for work I think it's enough to focus on several lines that contain the data they need

Code: Select all

  <cfdi:Emisor Rfc="SASS1234569E3" Nombre="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" RegimenFiscal="621"></cfdi:Emisor>
  <cfdi:Receptor Rfc="SDT1234565C8" Nombre="yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" UsoCFDI="G01"></cfdi:Receptor>
this is like data header Emisor and Receptor record data

Code: Select all

 <cfdi:Concepto ClaveProdServ="50161800" Cantidad="1" ClaveUnidad="H87" Unidad="CAJA" Descripcion="CHUPON DEDITO" ValorUnitario="435.00" Importe="435.00" Descuento="21.75">
      <cfdi:Impuestos>
        <cfdi:Traslados>
          <cfdi:Traslado Base="413.25" Impuesto="003" TipoFactor="Tasa" TasaOCuota="0.080000" Importe="33.06"></cfdi:Traslado>
        </cfdi:Traslados>
      </cfdi:Impuestos>
    </cfdi:Concepto>
and this is records Concepto and Traslados, I think they are a logical unit and need save them into one record

The good side of the XML format is that it also contains the field name and field contents
xml.jpg
xml.jpg (86.62 KiB) Viewed 2805 times
this is screenshot of program XMLPad
martingz
Posts: 394
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico

Re: Lectura de archivos XML

Post by martingz »

Andy te puedo enviar unas muestras de un lector de xml que desarrolle, es muy especifico a los datos pero te puedes dar una idea de como empezar


saludos
jorge.posadas
Posts: 172
Joined: Mon May 19, 2014 7:43 pm
DBs Used: DBF, SQLite, MS-SQL, ACCESS, MariaDB (en proceso)
Location: Morelia, Mich. México
Contact:

Re: Lectura de archivos XML

Post by jorge.posadas »

Martín,

Yo me apunto para esa "muestra de lector xml", de antemano gracias
Cordialmente

POSADAS SOFTWARE
Jorge Posadas Ch.
Programador independiente
Morelia, Mich.
M é x i c o .
Movil +52 44 3734 1858
SKYPE: jorge.posadasch
Email: posoft@gmx.com
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Lectura de archivos XML

Post by andyglezl »

Thanks Dragancesu

------------------------------

Gracias Martin,

Si me interesan tus ejemplos para poder empezar
Andrés González López
Desde Guadalajara, Jalisco. México.
martingz
Posts: 394
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico

Re: Lectura de archivos XML

Post by martingz »

Como decia es muy basico se puede mejorar bastante, pero era algo que urgia para una auditoria, no hubo tiempo de refinarlo, pueden bajarlo de este link


https://mega.nz/#!YlR0USwL!eOtG3MlWnYq5 ... OWTvx0bnGQ


saludos
Post Reply