aboutsummaryrefslogtreecommitdiffstats
path: root/util/xml.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/xml.lua')
-rw-r--r--util/xml.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/util/xml.lua b/util/xml.lua
index 733d821a..9e12f0df 100644
--- a/util/xml.lua
+++ b/util/xml.lua
@@ -14,6 +14,17 @@ local parse_xml = (function()
--luacheck: ignore 212/self
local handler = {};
local stanza = st.stanza("root");
+ local namespaces = {}
+ function handler:StartNamespaceDecl(prefix, url)
+ if prefix ~= nil then
+ namespaces[prefix] = url
+ end
+ end
+ function handler:EndNamespaceDecl(prefix)
+ if prefix ~= nil then
+ namespaces[prefix] = nil
+ end
+ end
function handler:StartElement(tagname, attr)
local curr_ns,name = tagname:match(ns_pattern);
if name == "" then
@@ -34,7 +45,11 @@ local parse_xml = (function()
end
end
end
- stanza:tag(name, attr);
+ local n = {}
+ for prefix, url in pairs(namespaces) do
+ n[prefix] = url
+ end
+ stanza:tag(name, attr, n);
end
function handler:CharacterData(data)
stanza:text(data);