mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
Make PubSub's SimplePayload infer the XML Element name and namespace
Fixes SMACK-816.
This commit is contained in:
parent
a3e365bfb9
commit
6c4a02691e
5 changed files with 94 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright © 2014-2017 Florian Schmaus
|
||||
* Copyright © 2014-2018 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -23,6 +23,9 @@ import java.text.ParseException;
|
|||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
|
@ -250,4 +253,14 @@ public class ParserUtils {
|
|||
public static String getXmlLang(XmlPullParser parser) {
|
||||
return parser.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang");
|
||||
}
|
||||
|
||||
public static QName getQName(XmlPullParser parser) {
|
||||
String elementName = parser.getName();
|
||||
String prefix = parser.getPrefix();
|
||||
if (prefix == null) {
|
||||
prefix = XMLConstants.DEFAULT_NS_PREFIX;
|
||||
}
|
||||
String namespace = parser.getNamespace();
|
||||
return new QName(namespace, elementName, prefix);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue