XML Handling

Ralph DiMola rdimola at evergreeninfo.net
Fri May 23 10:48:59 EDT 2014

Peter forgot to add some code snippets. This from my Google geo-coding xml
parsing routine.

put url  ("http://maps.googleapis.com/maps/api/geocode/xml?address=" & add1
& comma & "+" & CSZ & "&sensor=false") into gxml
delete line 1 in gxml
put revCreateXMLTree(gxml,true,true,false) into txml
put revxmlnodecontents(txml,"GeocodeResponse/status") into geo["Status"]

repeat with I = 1 to
  switch revxmlnodecontents(txml,"GeocodeResponse/result/address_component["
& I & "]/type")

put  revXMLChildNames(txml,"/GeocodeResponse/result/geometry",comma,,false)
into str1
repeat for each item nodename in str1
 switch nodename
 Case "location"
into geo["Lat"]["Center"]

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net

-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of Peter Hermsen
Sent: Friday, May 23, 2014 9:42 AM
To: use-livecode at lists.runrev.com
Subject: XML Handling

Sorry for the long post. I'm trying to convert some programs from PHP to
livecode.  I've been working with LiveCode for several years and haven't had
the opportunity to work with XML until now.  I went through the LiveCode
lesson on reading from an XML file, but am running into problems when
working with live data.  I used the example in:


When I applied the same methods to my data, I can't retrieve my data values.
Instead, I get only "empty" and "xmlerr".  If anybody could guide me in the
right direction, I'd really appreciate it.  Here's an example data file:

<?xml version="1.0" encoding="UTF-8"?>
             <address_1>123 Street Rd.</address_1>
             <address_2>Apartment 6</address_2>
             <city>Some City</city>
             <email>joe at smith.com</email>
             <address_1>456 Raod St.</address_1>
             <address_2>Some Suburb</address_2>
             <city>My Little Town</city>
             <email>jane at bigserver.com</email>

Using PHP I can easily convert the above file to an Array.  However,
LiveCode is being a bit more challenging.

Many thanks,
Pete Hermsen

use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription

More information about the Use-livecode mailing list