Software /
code /
prosody
Comparison
core/xmlhandlers.lua @ 2505:0849e349992d
xmlhandlers: A little optimization.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 26 Jan 2010 03:39:24 +0500 |
parent | 2493:ec09d16a51e1 |
child | 2506:d11a781baf13 |
comparison
equal
deleted
inserted
replaced
2504:8b12ee9a5027 | 2505:0849e349992d |
---|---|
110 if stanza then | 110 if stanza then |
111 t_insert(chardata, data); | 111 t_insert(chardata, data); |
112 end | 112 end |
113 end | 113 end |
114 function xml_handlers:EndElement(tagname) | 114 function xml_handlers:EndElement(tagname) |
115 local curr_ns,name = tagname:match(ns_pattern); | |
116 if name == "" then | |
117 curr_ns, name = "", curr_ns; | |
118 end | |
119 if stanza then | 115 if stanza then |
120 if #chardata > 0 then | 116 if #chardata > 0 then |
121 -- We have some character data in the buffer | 117 -- We have some character data in the buffer |
122 stanza:text(t_concat(chardata)); | 118 stanza:text(t_concat(chardata)); |
123 chardata = {}; | 119 chardata = {}; |
137 if tagname == stream_tag then | 133 if tagname == stream_tag then |
138 if cb_streamclosed then | 134 if cb_streamclosed then |
139 cb_streamclosed(session); | 135 cb_streamclosed(session); |
140 end | 136 end |
141 else | 137 else |
138 local curr_ns,name = tagname:match(ns_pattern); | |
139 if name == "" then | |
140 curr_ns, name = "", curr_ns; | |
141 end | |
142 cb_error(session, "parse-error", "unexpected-element-close", name); | 142 cb_error(session, "parse-error", "unexpected-element-close", name); |
143 end | 143 end |
144 stanza, chardata = nil, {}; | 144 stanza, chardata = nil, {}; |
145 end | 145 end |
146 end | 146 end |