util/xml.lua
changeset 6666 d3023dd07cb6
parent 5776 bd0ff8ae98a8
child 6672 7da8b6bc0966
equal deleted inserted replaced
6665:5ef319efedba 6666:d3023dd07cb6
     9 		["http://www.w3.org/XML/1998/namespace"] = "xml";
     9 		["http://www.w3.org/XML/1998/namespace"] = "xml";
    10 	};
    10 	};
    11 	local ns_separator = "\1";
    11 	local ns_separator = "\1";
    12 	local ns_pattern = "^([^"..ns_separator.."]*)"..ns_separator.."?(.*)$";
    12 	local ns_pattern = "^([^"..ns_separator.."]*)"..ns_separator.."?(.*)$";
    13 	return function(xml)
    13 	return function(xml)
       
    14 		--luacheck: ignore 212/self
    14 		local handler = {};
    15 		local handler = {};
    15 		local stanza = st.stanza("root");
    16 		local stanza = st.stanza("root");
    16 		function handler:StartElement(tagname, attr)
    17 		function handler:StartElement(tagname, attr)
    17 			local curr_ns,name = tagname:match(ns_pattern);
    18 			local curr_ns,name = tagname:match(ns_pattern);
    18 			if name == "" then
    19 			if name == "" then