Page 1 of 1

get data from an XML file

Posted: Wed Mar 20, 2013 5:40 am
by PedroAlex
Hello gentlemens

Could someone share some example of how to open a xml file and read the xml tags and get data from that tags,
or
refer some technique to find the best way to do it.

Very thanks in advance.

best regards.
Pedro.

Re: get data from an XML file

Posted: Wed Mar 20, 2013 5:42 am
by skiman
Hi,

I'm using the free Chilkat activeX component.

Re: get data from an XML file

Posted: Wed Mar 20, 2013 7:31 am
by rdonnay
Look at the samples in \exp19\samples\xml.

I use the DC_Xml2ObjectTree() and DC_XmlNode() functions.

Re: get data from an XML file

Posted: Thu Mar 21, 2013 5:45 am
by PedroAlex
Chris and Roger.
Thanks for feedback.

DC_Xml2ObjectTree and Dc_XmlNode is working for me .

here is a small sample just for share...

oTree := DC_Xml2ObjectTree( FileXML ) // FileXML is the source file XML
aDataSet := oTree:findNode( 'DataSet' ) // 'Dataset' is the root node
aTable := aDataSet:findNode( 'Table',.t. ) // 'Table' is the subnode

for i :=1 to len(aTable)
oNome := aTable:findNode('NOME')
cNome := oNome:content
oTel := aTable:findNode('TELEFONE')
cTel := oTel:content
oNif := aTable:findNode('NIF')
cNif := oNif:content
NEXT

Best Regards
Pedro