Software /
code /
prosody
Diff
core/xmlhandlers.lua @ 2077:e33658f6052c
Changed separator between attribute names and prefixes from '|' to '\1' (optimization and cleanup).
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 12 Nov 2009 13:42:44 +0500 |
parent | 2037:a919511c45ac |
child | 2261:13d55c66bf81 |
line wrap: on
line diff
--- a/core/xmlhandlers.lua Thu Nov 12 13:34:38 2009 +0500 +++ b/core/xmlhandlers.lua Thu Nov 12 13:42:44 2009 +0500 @@ -29,7 +29,6 @@ function init_xmlhandlers(session, stream_callbacks) local ns_stack = { "" }; - local curr_ns, name = ""; local curr_tag; local chardata = {}; local xml_handlers = {}; @@ -50,7 +49,7 @@ stanza:text(t_concat(chardata)); chardata = {}; end - local curr_ns,name = tagname:match("^(.-)|?([^%|]-)$"); + local curr_ns,name = tagname:match("^([^\1]*)\1?(.*)$"); if not name then curr_ns, name = "", curr_ns; end @@ -63,7 +62,7 @@ for i=1,#attr do local k = attr[i]; attr[i] = nil; - local ns, nm = k:match("^([^|]+)|?([^|]-)$") + local ns, nm = k:match("^([^\1]*)\1?(.*)$"); if ns and nm then ns = ns_prefixes[ns]; if ns then @@ -105,7 +104,7 @@ end end function xml_handlers:EndElement(tagname) - curr_ns,name = tagname:match("^(.-)|?([^%|]-)$"); + local curr_ns,name = tagname:match("^([^\1]*)\1?(.*)$"); if not name then curr_ns, name = "", curr_ns; end