From e973117aedb3ef7060820b7259b27587db3fcbf4 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 30 May 2017 08:38:33 +0200 Subject: [PATCH] deal with namespace attributes. fixes #2495 --- .../java/eu/siacs/conversations/xml/XmlReader.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xml/XmlReader.java b/src/main/java/eu/siacs/conversations/xml/XmlReader.java index 58ef07f97..f2aade45b 100644 --- a/src/main/java/eu/siacs/conversations/xml/XmlReader.java +++ b/src/main/java/eu/siacs/conversations/xml/XmlReader.java @@ -65,11 +65,17 @@ public class XmlReader { wakeLock.acquire(); if (parser.getEventType() == XmlPullParser.START_TAG) { Tag tag = Tag.start(parser.getName()); + final String xmlns = parser.getNamespace(); for (int i = 0; i < parser.getAttributeCount(); ++i) { - tag.setAttribute(parser.getAttributeName(i), - parser.getAttributeValue(i)); + final String prefix = parser.getAttributePrefix(i); + String name; + if (prefix != null && !prefix.isEmpty() && !prefix.equals(xmlns)) { + name = prefix+":"+parser.getAttributeName(i); + } else { + name = parser.getAttributeName(i); + } + tag.setAttribute(name,parser.getAttributeValue(i)); } - String xmlns = parser.getNamespace(); if (xmlns != null) { tag.setAttribute("xmlns", xmlns); }