Page 1 of 1

Xml a un Array

PostPosted: Wed Feb 07, 2018 3:23 pm
by jose_murugosa
Queridos amigos, una consulta..
Hay alguna forma sencilla de pasar un archivo XML a un array bidimencional?

Gracias desde ya.

Re: Xml a un Array

PostPosted: Thu Feb 08, 2018 4:03 pm
by jose_murugosa
Cualquier ayuda o sugerencia se agradece :)

Re: Xml a un Array

PostPosted: Thu Feb 08, 2018 4:55 pm
by karinha

Re: Xml a un Array

PostPosted: Fri Feb 09, 2018 7:00 am
by Antonio Linares
José,

Usando este ejemplo xmlreader.prg incluido en FWH\samples puedes facilmente hacerlo:

Code: Select all  Expand view
// Simple example for a generic XML reader

#include "FiveWin.ch"

function Main()
   
   local hFile    := FOpen( "test.xml" )
   Local oXmlDoc  := TXmlDocument():New( hFile )
   Local oXmlIter := TXmlIterator():New( oXmlDoc:oRoot ), oTagActual

   while .T.
      oTagActual = oXmlIter:Next()
      If oTagActual != nil
         MsgInfo( oTagActual:cName, oTagActual:cData )
         HEval( oTagActual:aAttributes, { | cKey, cValue | MsgInfo( cKey, cValue ) } )
      Else
         Exit
      Endif
   End

   FClose( hFile )

return nil

Re: Xml a un Array

PostPosted: Fri Feb 09, 2018 10:16 am
by jose_murugosa
Muuuuuuuuchas gracias Karinha, Antonio....

Ya tengo para entretenerme :)

Luego les cuento los resultados.

Re: Xml a un Array

PostPosted: Sat Feb 10, 2018 4:16 pm
by jose_murugosa
Gracias por vuestra ayuda, objetivo cumplido. :)

Re: Xml a un Array

PostPosted: Sat Feb 10, 2018 11:38 pm
by joseluisysturiz
jose_murugosa wrote:Gracias por vuestra ayuda, objetivo cumplido. :)


...y el sample compartido..? saludos...gracias... :shock: