Cluain / Lua-Simple-XML-Parser

Read simple XML easily
153 stars 91 forks source link

Fixes to the way attributes are handled. #13

Open WReaganHarper opened 7 years ago

WReaganHarper commented 7 years ago

1) Value attributes in props were being set to undefined self key. 2) Attributes with multiple values were handled improperly in props. 3) According to XML spec, an attribute may only have one attribute of a given name. Therefore, the whole if statement "if self[lName] ~= nil then" block can go away, and the code in the else is all that should live. I kept it for backwards compatibility, but added a warning. 4) Attribute values can now be directly referenced via node:properties().attribute_name as well as node["@attribute_name"] and node:properties()[attribute_number].value. This allows "for attr_name, attr_val in pairs(node:properties()) do" to work.

lfeng1420 commented 6 years ago

219 + table.insert(self.___props, {naame = name, value = self[lName] }) naame or name?