lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 24 January 2014 07:53, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
> Yeah, I know... I'll see what I can do. Thanks again.

Have a look into what people have done before :)

The closest thing first in mind is lxp's (lua expat) "lom"
http://matthewwild.co.uk/projects/luaexpat/lom.html

Otherwise consider looking into prosody's 'stanza' object:
http://hg.prosody.im/trunk/file/tip/util/stanza.lua
<foo qwe="rty">text<bar/>more</foo> looks like: {
    name = "foo";
    attr = { qwe = "rty" };
    tags = {
        { name = "bar" , attr = {} , tags = {} } ;
    } ;
    "text";
    { name = "bar" , attr = {} , tags = {} } ; -- Same object as above
    "more";
Child tags are referenced in two places for fast accessing via index
of tag; or overall.