Module ddsl.xtypes.xml.parser

Parse a well formed XML string, and generate an equivalent Lua table.

The Lua table is connstructed as follows.

  • XML String:
    <tag attr1=value1 attr2=value2>
      <child1> ... </child1>
      <child2> ... </child2>
      <!--comment -->
    </tag>
    
  • Lua Table:
    tag = {
      -- array: children: tag[i] --
      { -- child1: recursive },
      { -- child2: recursive },
      "<!--comment ",
    
      -- map: tag name and attributes: tag.label, tag.xarg --
      xarg  = { -- may be empty
        attr1 = value1
        attr2 = value2
      }
      label = "tag",
      [empty=1,] -- iff there are no child tags
    }
    

Functions

table2luastring (tbl) Convert a Lua table to an equivalent string representation.
xmlstring2table (s) Convert an XML string to a Lua table.


Functions

table2luastring (tbl)
Convert a Lua table to an equivalent string representation. The string can be is a dump the table contents in Lua syntax.

Parameters:

Returns:

    string the contents of the table as a string
xmlstring2table (s)
Convert an XML string to a Lua table.

Parameters:

Returns:

    table table containing the equivalent Lua table representation
generated by LDoc 1.4.3 Last updated 2015-11-07 15:24:54