From 7b5d5165d18042dcb99570e2b3e66afa011e7546 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Wed, 31 May 2017 21:28:02 +0200 Subject: deal with namespace attributes --- src/main/java/de/pixart/messenger/xml/XmlReader.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/de/pixart/messenger/xml/XmlReader.java b/src/main/java/de/pixart/messenger/xml/XmlReader.java index efd4dcc95..1de61e54c 100644 --- a/src/main/java/de/pixart/messenger/xml/XmlReader.java +++ b/src/main/java/de/pixart/messenger/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); } -- cgit v1.2.3