manoelcampos / xml2lua

XML Parser written entirely in Lua that works for Lua 5.1+. Convert XML to and from Lua Tables 🌖💱
MIT License
287 stars 73 forks source link

Test failure: acceptance_test_repeated_tags1_spec.lua:47: there should have an item with a 'something1' myattr value #69

Closed manoelcampos closed 1 year ago

manoelcampos commented 2 years ago

The given table:

 tag = {
        array = {
            item = { _attr = { myattr = "something1" } },
            item = { _attr = { myattr = "something2" } },
        }
}

should be parsed as the following XML:

<tag>
  <array>
    <item myattr="something1"/>
    <item myattr="something2"/>
  </array>
</tag>

but only the last item tag is being generated in the final XML.

nilzao commented 1 year ago

the given table:

 tag = {
        array = {
            item = { _attr = { myattr = "something1" } },
            item = { _attr = { myattr = "something2" } },
        }
}

will have only one item because of the key value.

should be:

tag = {
  array = {
    item = { { _attr = { myattr = "something1" } },
             { _attr = { myattr = "something2" } } }
  }
}