Closed ArthurAttout closed 1 year ago
Calling xml2lua.toXml() twice on the same structure yields the same result, once with attributes and once without.
xml2lua.toXml()
AFAIK, this call should be idempotent, I don't see any reason why it would return two distinct results.
Sample code :
local xml2lua = require("xml2lua") local people = { person = { {name="Manoel", city="Palmas-TO", _attr={ type='natural' } }, {name="Breno", city="Palmas-TO", _attr={ type='legal' } } } } print("People Table\n") xml2lua.printable(people) print() print("XML Representation\n") print(xml2lua.toXml(people, "people")) print(xml2lua.toXml(people, "people"))
Result :
People Table person 1 _attr type=natural name=Manoel city=Palmas-TO 2 _attr type=legal name=Breno city=Palmas-TO XML Representation <people> <person type="natural"> <name>Manoel</name> <city>Palmas-TO</city> </person> <person type="legal"> <name>Breno</name> <city>Palmas-TO</city> </person> </people> <people> <person> <name>Manoel</name> <city>Palmas-TO</city> </person> <person> <name>Breno</name> <city>Palmas-TO</city> </person> </people>
Tested on 1f8d90b.
PR #89 fixes it
Calling
xml2lua.toXml()
twice on the same structure yields the same result, once with attributes and once without.AFAIK, this call should be idempotent, I don't see any reason why it would return two distinct results.
Sample code :
Result :
Tested on 1f8d90b.