Best way to convert XML to datagrid
Glen Bojsza
gbojsza at gmail.com
Sat Sep 27 01:17:10 EDT 2014
Hello everyone,
I am trying to help with an old system that returns thousands of lines
similar to the text below.
The only thing I need to do is convert it to a datagrid.I can prebuild the
datagrid with the correct cloumns but what is the best way in extracting
the data out of the xml format?
I was pretty certain a couple of years ago you could take xml data directly
into a datagrid if the datagrid was already built with the correct column
headers matching the nodes ; in a single command?
I could do repeat loops similar to
* put* field "xmlResponse" into tResponse
*put* revCreateXMLTree(tResponse, false, true, false) into tDocID
*put* revXMLNodeContents(tDocID,
"/Envelope/Body/GetCPEBySerialSearchResponse/CPEList/CPE/id") --changing
the "id" to serial and then username ..etc
Any suggestions on the best method is appreciated.
regards,
============================================================
Sample of xml response is below
============================================================
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:gbadmin="urn:gbadmin-api-3-1-0">
<SOAP-ENV:Body SOAP-ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/">
<gbadmin:GetCPEBySerialSearchResponse>
<CPEList xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="gbadmin:CPEStruct[2]">
<CPE>
<id>
2</id>
<serial>
CP1238RA52F</serial>
<username>
</username>
<password>
</password>
<ipaddr>
192.168.1.254</ipaddr>
<mfr-id>
3</mfr-id>
<dm-id>
4</dm-id>
<last-comm-tm>
2014-09-10T04:28:59Z</last-comm-tm>
<updated-tm>
2014-09-10T04:28:59Z</updated-tm>
<created-tm>
2014-09-10T01:55:45Z</created-tm>
</CPE>
<CPE>
<id>
3</id>
<serial>
CP1238RA52G</serial>
<username>
</username>
<password>
</password>
<ipaddr>
</ipaddr>
<mfr-id>
3</mfr-id>
<dm-id>
4</dm-id>
<last-comm-tm>
2014-09-20T11:33:29Z</last-comm-tm>
<updated-tm>
2014-09-20T11:33:29Z</updated-tm>
<created-tm>
2014-09-20T11:33:29Z</created-tm>
</CPE>
</CPEList>
</gbadmin:GetCPEBySerialSearchResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
More information about the use-livecode
mailing list