@@ -113,7 +113,9 @@ function tree:starttag(tag)
113
113
node ._attr = tag .attrs
114
114
end
115
115
116
+ -- Table in the stack representing the tag being processed
116
117
local current = self ._stack [# self ._stack ]
118
+
117
119
if current [tag .name ] then
118
120
table.insert (current [tag .name ], node )
119
121
else
128
130
-- where name is the name of the tag and attrs
129
131
-- is a table containing the atributtes of the tag
130
132
function tree :endtag (tag , s )
131
- -- Table representing the tag being processed
133
+ -- Table in the stack representing the tag being processed
132
134
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
134
136
local prev = self ._stack [# self ._stack - 1 ]
135
137
if not prev [tag .name ] then
136
138
error (" XML Error - Unmatched Tag [" .. s .. " :" .. tag .name .. " ]\n " )
@@ -141,18 +143,6 @@ function tree:endtag(tag, s)
141
143
end
142
144
143
145
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
-
156
146
table.remove (self ._stack )
157
147
end
158
148
0 commit comments