lua-users home
lua-l archive

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

On Mon, Aug 22, 2016 at 6:59 PM, Roberto Ierusalimschy
<> wrote:
> I like this format. It is quite similar to what my original
> quick-and-dirty XML parser in Lua did (except that it used 'label'
> instead of 'name', 'args' instead of 'attr', and does not have 'tags').

A modification of that self-same little parser lives in penlight:

> pretty.dump(xml.basic_parse("<hello a='1'>bonzo</hello>"))
  attr = {
    a = "1"
  tag = "hello"

This is the so-called LOM (Lua Object Model) format

Incidentally, pl.xml was based on Prosody's stanza.lua

The nice thing about these styles of representation, of course, is
that looping from 1 to #t gives you the children.  (Note: I still
believe in #)