XML Parser written entirely in Lua that works for Lua 5.1+. Convert XML to and from Lua Tables 🌖💱
Contributions from @nilzao and @doj Thank you all.
Fix conversion of arrays to XML, correctly using the name of the array as tag names instead of using their indexes. For instance, consider the following XML:
<object>
<item>item 1</item>
<item>item 2</item>
</object>
That XML is converted to the following lua table, where item
is an array:
object = {
item = {'item 1', 'item 2'}
}
Converting such a table back to XML was wrongly resulting in:
<object>
<1>item 1</2>
<2>item 2</2>
</object>
Now the conversion from the lua table returns the same XML shown at the top of this document.
Ensures all attributes are included when serializing a Lua table to XML.
Introduces the xml2lua.toXml()
function to convert a Lua Table to its XML representation.
Check example4-table2xml.lua for details.
Just fix an issue with the rockspec file to download the module using luarocks.
Now the module works with Lua 5.1 to 5.3.
Small fix in the parser.