XML

I’ve been reading up on XML in Lua and of course have found these links, which seem useful:

http://developer.anscamobile.com/content/changes-lua
http://lua-users.org/wiki/LuaXml
http://viremo.eludi.net/LuaXML/index.html

What I’d like to know is how to use a lua XML implementation, considering that we cannot (in Corona) build in C based APIs into our code.

LuaXML looks to be very good, but a work in progress, so I understand why Ansca are “not happy with the solutions out there”, but is there a reasonable alternative which comes properly documented and can W/R XML? Even a paid-for one?

Thanks,

Matt. [import]uid: 8271 topic_id: 8218 reply_id: 308218[/import]

check this out
http://developer.anscamobile.com/code/open-source-stock-app [import]uid: 12108 topic_id: 8218 reply_id: 29393[/import]

Thanks, I was looking at the weather app - but I need to be able to read and write the XML files. There doesn’t seem to be a single solution for that, unless I’m missing something? [import]uid: 8271 topic_id: 8218 reply_id: 29439[/import]

Use Corona’s file handling commands to read in the file. It’ll read in as a string that you then pass to LuaXML; at that point it’s just like how that example app reads from an HTTP request into a string.

I don’t know how experienced you are with XML, but open up some XML files in a text editor and you’ll see that they’re simply standard text written with goofy < > symbols. An XML parser (eg. LuaXML) simply looks for those symbols and uses those tags to generate a table with all the information arranged in it. It’s like when you write the outline for an essay; all the indents and headings and what not tell you how to arrange the information into paragraphs.

ADDITION: Actually wait, now that I’m looking at the weather app page, it looks like it downloads the data into a local file and then opens that file. Did you miss that part? [import]uid: 12108 topic_id: 8218 reply_id: 29473[/import]

Hi i am Parsing my XML File using the Example Weather application…

Following Issues are raised regarding XML please help

  1. if tag Name Contains _(Underscore) then at the time of tag name Retrieving I got only String which is before the Underscore character.

eg if tag name in xml like <satisfaction_rate> then if i parse this then it will give me Tag name like satisfaction only it will neglect rest of part.

so at the time of comparison it shows mismatch.

any solution?

2. How do i access this rank=“1” value in my xml parser?

3. type is a keyword in lua?? i cant take this as tag Name?? [import]uid: 42171 topic_id: 8218 reply_id: 33077[/import] </satisfaction_rate>

I just published a new blog post that walks you through using XML files in a Corona SDK project:

http://blog.anscamobile.com/2011/07/how-to-use-xml-files-in-corona/ [import]uid: 52430 topic_id: 8218 reply_id: 47902[/import]

@jonathanbeebe
I think a useful sample for this would be parse the ansca blog rss into a widget tableview. I think that would be a great widget sample, perhaps set a listener to auto refresh the rss list every few minutes with a timer?

I just went over the widget API and didn’t find the “populate from xml” that was in the coronaui.lua, is it coming something similar for widgets in August? [import]uid: 13560 topic_id: 8218 reply_id: 47908[/import]