Well that minus sign on line 3 is a problem. The XML module presented in that tutorial (I’m assuming it was this one: http://www.coronalabs.com/blog/2011/07/29/how-to-use-xml-files-in-corona/), should be able to read that file just fine. You also need a table printing function to see what it’s returning and how it’s returned. I use something called print_r() which can be found in the community code (Named after the similar function in PHP) that dumps your table. Here’s the one I use:
function print\_r ( t ) local print\_r\_cache={} local function sub\_print\_r(t,indent) if (print\_r\_cache[tostring(t)]) then print(indent.."\*"..tostring(t)) else print\_r\_cache[tostring(t)]=true if (type(t)=="table") then for pos,val in pairs(t) do if (type(val)=="table") then print(indent.."["..pos.."] =\> "..tostring(t).." {") sub\_print\_r(val,indent..string.rep(" ",string.len(pos)+8)) print(indent..string.rep(" ",string.len(pos)+6).."}") elseif (type(val)=="string") then print(indent.."["..pos..'] =\> "'..val..'"') else print(indent.."["..pos.."] =\> "..tostring(val)) end end else print(indent..tostring(t)) end end end if (type(t)=="table") then print(tostring(t).." {") sub\_print\_r(t," ") print("}") else sub\_print\_r(t," ") end print() end
But like @no2games said, Lua’s table structure is very JSON like and our built in json.decode and json.encode API calls work really well. XML because it’s not key-value pair based. While each tag can have multiple key-value attributes, you have to deal with the data that exists in between the tags.
Give the print_r function a try and see what you’re actually parsing out.