Comparison

core/xmlhandlers.lua @ 1154:570c0427fcb8

xmlhandlers: Removed an unnecessary check
author Waqas Hussain <waqas20@gmail.com>
date Fri, 15 May 2009 07:27:03 +0500
parent 1153:1184cb19b6f2
child 1155:a93b25f1528e
comparison
equal deleted inserted replaced
1153:1184cb19b6f2 1154:570c0427fcb8
12 12
13 local st = stanza; 13 local st = stanza;
14 local tostring = tostring; 14 local tostring = tostring;
15 local pairs = pairs; 15 local pairs = pairs;
16 local ipairs = ipairs; 16 local ipairs = ipairs;
17 local type = type;
18 local t_insert = table.insert; 17 local t_insert = table.insert;
19 local t_concat = table.concat; 18 local t_concat = table.concat;
20 19
21 local default_log = require "util.logger".init("xmlhandlers"); 20 local default_log = require "util.logger".init("xmlhandlers");
22 21
60 attr.xmlns = curr_ns; 59 attr.xmlns = curr_ns;
61 end 60 end
62 61
63 -- FIXME !!!!! 62 -- FIXME !!!!!
64 for i, k in ipairs(attr) do 63 for i, k in ipairs(attr) do
65 if type(k) == "string" then 64 local ns, nm = k:match("^([^|]+)|?([^|]-)$")
66 local ns, nm = k:match("^([^|]+)|?([^|]-)$") 65 if ns and nm then
67 if ns and nm then 66 ns = ns_prefixes[ns];
68 ns = ns_prefixes[ns]; 67 if ns then
69 if ns then 68 attr[ns..":"..nm] = attr[k];
70 attr[ns..":"..nm] = attr[k]; 69 attr[i] = ns..":"..nm;
71 attr[i] = ns..":"..nm; 70 attr[k] = nil;
72 attr[k] = nil;
73 end
74 end 71 end
75 end 72 end
76 end 73 end
77 74
78 if not stanza then --if we are not currently inside a stanza 75 if not stanza then --if we are not currently inside a stanza