Я просто изучаю Livecode и пробую несколько руководств, чтобы получить данные из формата XML. Я просто путаю.
Вот мой XML-код:
<current><city id="1642911" name="London"><coord lon="106.83" lat="-6.17"/><country>Indonesia</country><sun rise="2014-05-29T22:56:30" set="2014-05-30T10:43:59"/></city><temperature value="302.254" min="302.254" max="302.254" unit="kelvin"/><humidity value="76" unit="%"/><pressure value="971.07" unit="hPa"/><wind><speed value="1.24" name="Calm"/><direction value="20.5019" code="NNE" name="North-northeast"/></wind><clouds value="20" name="few clouds"/><precipitation mode="no"/><weather number="801" value="few clouds" icon="02d"/><lastupdate value="2014-05-30T04:50:44"/></current>
А вот мой код Livecode:
<?lc
#get location
put url ("http://api.openweathermap.org/data/2.5/weather?q=London&mode=xml") into Location
#get lon and lat
put revCreateXMLTree(Location, false, true, false) into locationTree
put revXMLNodeContents(locationTree, "current/city/coord/lat") into latitude
put revXMLNodeContents(locationTree, "current/city/coord/lat") into longitude
#put longitude and latitude information to weather url
put url ("http://api.openweathermap.org/data/2.5/weather?lat=" & latitude & "&lon=" & longitude & "&mode=html") into weather
put weather
Проблема в том, что я не знаю, как вызвать данные в XML (locationTree, "current/city/coord/lat")
, код которых похож на этот <coord lon="106.83" lat="-6.17"/>
. Не могли бы вы помочь мне? Спасибо.