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 ...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
        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)

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.

1
2
3
4
5
6
7
settings =
{
   androidPermissions =
   {
       "android.permission.INTERNET"
   },
}

Got it ... thanks!

views:1564 update:2011/10/9 22:34:50
corona forums © 2003-2011