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, 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]
@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]