Skip to content

Commit b8cc148

Browse files
committed
Closes #23
1 parent 8a9da53 commit b8cc148

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

xml2lua-1.2-3.rockspec renamed to xml2lua-1.2-4.rockspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package = "xml2lua"
2-
version = "1.2-3"
2+
version = "1.2-4"
33
source = {
44
url = "git://github.com/manoelcampos/xml2lua",
5-
tag = "v1.2-3"
5+
tag = "v1.2-4"
66
}
77
description = {
88
summary = "An XML Parser written entirely in Lua that works for Lua 5.1 to 5.3",

xmlhandler/tree.lua

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ function tree:starttag(tag)
113113
node._attr=tag.attrs
114114
end
115115

116+
--Table in the stack representing the tag being processed
116117
local current = self._stack[#self._stack]
118+
117119
if current[tag.name] then
118120
table.insert(current[tag.name], node)
119121
else
@@ -128,9 +130,9 @@ end
128130
-- where name is the name of the tag and attrs
129131
-- is a table containing the atributtes of the tag
130132
function tree:endtag(tag, s)
131-
--Table representing the tag being processed
133+
--Table in the stack representing the tag being processed
132134
local current = self._stack[#self._stack]
133-
--Table representing the containing tag of the current tag
135+
--Table in the stack representing the containing tag of the current tag
134136
local prev = self._stack[#self._stack-1]
135137
if not prev[tag.name] then
136138
error("XML Error - Unmatched Tag ["..s..":"..tag.name.."]\n")
@@ -141,18 +143,6 @@ function tree:endtag(tag, s)
141143
end
142144

143145
local firstKey = getFirstKey(current)
144-
--[[
145-
If the first key in the table representing the current tag
146-
doesn't have any element, it's because there is no value for
147-
that tag (such as for a auto-closing tag like <password />).
148-
This way, assigns an empty string to that key
149-
instead of returning an empty table.
150-
--]]
151-
if firstKey == nil then
152-
current[tag.name] = ""
153-
prev[tag.name] = ""
154-
end
155-
156146
table.remove(self._stack)
157147
end
158148

0 commit comments

Comments
 (0)