[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: XML Support for Penlight?
- From: Henk Boom <henk@...>
- Date: Mon, 28 Mar 2011 18:09:50 -0400
On 28 March 2011 15:18, Petite Abeille <petite.abeille@gmail.com> wrote:
>
> On Mar 28, 2011, at 8:41 PM, Lucas Zawacki wrote:
>
>> In
>> the end of the day it's more about the mindset of the coder, in Lua
>> people tend to like it very simple.
>
> Talking of which, I like David Sklar's BadgerFish convention for translating an XML document into a Lua table:
>
> http://ajaxian.com/archives/badgerfish-translating-xml-to-json
>
> Here is a simplistic implementation:
>
> http://dev.alt.textdrive.com/browser/HTTP/XML.lua
>
> Usage example:
>
> local XML = require( 'XML' )
> local anXML = XML( aContent ) -- e.g. http://www.lua.org/news.rss
>
> print( anXML.rss.channel.description[ '$' ] )
Is there a way to get at the child elements in their original order,
e.g. for XHTML-type stuff?
henk