From Blue Mars Developer Guidebook
Return to XMLtoLua
- ARLoadXML(definitionFile, dataFile)
- return value - a table representing the contents of an XML file, null if the file is not loaded
- definitionFile - string XML file that specifies how the conversion is performed
- dataFile - string XML file that is loaded and converted to Lua. The file is located under the Blue Mars user folder.
Use ARDownloadFile to download and save the dataFile to the user directory (if parsing XML is not required, see the alternate ARWebUtils.DownloadFile function, which returns data in a callback function).
Use ARSaveXML to convert a Lua table to an XML file.
- See the High Score Server example
- See ARGolfStatsDisplay which uses ARLoadXML to display recent golf games in the clubhouse, via Flash Material.
self.xmltable = ARLoadXML(self.Properties.recentgamesdef,self.Properties.xmlresults)
- Check the return value - if it's null instead of a table, then XML file was not successfully read and converted
- Check the - any mismatch between the definition file and the XML file will be reported