xmlhandlers: A little optimization.
authorWaqas Hussain <waqas20@gmail.com>
Tue, 26 Jan 2010 03:39:24 +0500
changeset 2505 0849e349992d
parent 2504 8b12ee9a5027
child 2506 d11a781baf13
xmlhandlers: A little optimization.
core/xmlhandlers.lua
--- a/core/xmlhandlers.lua	Tue Jan 26 02:30:56 2010 +0500
+++ b/core/xmlhandlers.lua	Tue Jan 26 03:39:24 2010 +0500
@@ -112,10 +112,6 @@
 		end
 	end
 	function xml_handlers:EndElement(tagname)
-		local curr_ns,name = tagname:match(ns_pattern);
-		if name == "" then
-			curr_ns, name = "", curr_ns;
-		end
 		if stanza then
 			if #chardata > 0 then
 				-- We have some character data in the buffer
@@ -139,6 +135,10 @@
 					cb_streamclosed(session);
 				end
 			else
+				local curr_ns,name = tagname:match(ns_pattern);
+				if name == "" then
+					curr_ns, name = "", curr_ns;
+				end
 				cb_error(session, "parse-error", "unexpected-element-close", name);
 			end
 			stanza, chardata = nil, {};