Referencing XML Elements

My application uses the pure lua xml parser found here:

http://lua-users.org/wiki/LuaXml

to parse XML retrieved from a web service. This all works fine in the simulator and builds (Android 2.2) successfully. However, when I attempt to use the application on a Droid X the application appears to crash when I try to reference an element.

Here is how I handle the XML …

[lua] local t = {}
http.request{
url = “http://www.personalpowerpath.com/xml/mmoftheday-xml.cfm”,
sink = ltn12.sink.table(t)
}
result = table.concat(t)

– Parse XML using simpleTreeHandler
h = simpleTreeHandler()
x = xmlParser(h)
x:parse(result)

print( “XML Parsed” )
print(h.root.items.item.author)[/lua]

My application works up until …

print(h.root.items.item.author)

Why is this a problem for the device?

[import]uid: 7296 topic_id: 2236 reply_id: 302236[/import]

On android you’ll need to specify that you need internet access.

Create a build.settings file next to your main.lua and put this in it.

settings =  
{  
 androidPermissions =  
 {  
 "android.permission.INTERNET"  
 },  
}  

This is demonstrated in the SimpleImageDownload sample code for reference. [import]uid: 3 topic_id: 2236 reply_id: 6788[/import]

Got it … thanks! [import]uid: 7296 topic_id: 2236 reply_id: 6796[/import]