Book Image

LiveCode Mobile Development Cookbook

By : Dr. Edward Lavieri
Book Image

LiveCode Mobile Development Cookbook

By: Dr. Edward Lavieri

Overview of this book

Table of Contents (17 chapters)
LiveCode Mobile Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Writing XML


XML files represent an organized method to save and quickly read information from files.

Getting ready

Since XML is a marked language used for organizing and nesting data, you must first determine what type of data you have and how you want it organized. For example, you might simply have vehicle makes and models, so your XML file structure would be <vehicle><make><model> and might look something like the following code:

<vehicle>
  <ford>
    <car>Taurus</car>
    <truck>F-350</truck>
    <van>E-150</van>
  </ford>

How to do it...

Use the following steps to create and write an XML data structure:

  1. To write XML data, use a function to write each line of text such as with the following code:

    function createXML theTag, theText
      local theXML
    
      put "<" & theTag & ">" into theXML
      put theText after theXML
      put "</" & theTag & ">" after theXML
      return theXML
    end createXML
  2. Once the entire...