xml2lua icon indicating copy to clipboard operation
xml2lua copied to clipboard

xml2lua.toXml() : Duplicated XML tags is broken when converting from Lua to XML

Open chrisaga opened this issue 1 year ago • 3 comments

Use case : create a lua table and convert it to XML with duplicated tags

based on xml2lua/example3.lua we could expect :

local tag = { tag1={ 1='A', 2='B' } }
print(xml2lua.toXml(tag, 'tag')

would give :

<tag>
    <tag1>A</tag1>
    <tag1>B</tag1>
</tag>

but it gives insead :

<tag>
    <tag1>
      <tag1>A</tag1>
      <tag1>B</tag1>
    </tag1>
</tag>

The easyest way to test it is to append the following line at the end of xml2lua/example3.lua (select the 3rd test by uncommenting line 18) :

print(xml2lua.toXml(handler.root.tag, 'tag'))

chrisaga avatar Dec 10 '22 20:12 chrisaga