deal with namespace attributes. fixes #2495

This commit is contained in:
Daniel Gultsch 2017-05-30 08:38:33 +02:00
parent 3ece613a5d
commit e973117aed
1 changed files with 9 additions and 3 deletions

View File

@ -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);
}