@@ -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
128130-- where name is the name of the tag and attrs
129131-- is a table containing the atributtes of the tag
130132function 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 )
157147end
158148
0 commit comments