Reading XML
XML (Extensible Markup Language) files represent an organized method to save and quickly read information from files.
How to do it...
Use the following steps to read the XML data:
Create a new main stack in LiveCode.
Set the background color of the main card to black.
Drag a new button to the card and assign the following properties:
Name:
btn_readXML
Label:
Read XML
threeD: Keep it unchecked
showBorder: Keep it unchecked
hiliteBorder: Keep it unchecked
backgroundColor: White
Create a text file with the following text. Save the file as
sample.xml
into thedocuments
folder on your mobile device:<sample> <language>English</language> <timeZone>ET</timeZone> </sample>
Assign the following code to the
btn_readXML
button:on mouseUp local xmlTree, tLanguage # Read XML File into memory put readXMLtoTree() into xmlTree # Retrieve specific piece of information put revXMLNodeContents(xmlTree, "sample/language") into tLanguage # Release...