1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-29 15:32:06 +01:00

Deprecate ParserUtils.getQName()

This commit is contained in:
Florian Schmaus 2019-06-02 10:44:50 +02:00
parent af6ee76f4c
commit 726a2de273
2 changed files with 11 additions and 10 deletions

View file

@ -23,7 +23,6 @@ import java.text.ParseException;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
@ -323,13 +322,16 @@ public class ParserUtils {
return parser.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang"); return parser.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang");
} }
/**
* Get the QName of the current element.
*
* @param parser the parser.
* @return the Qname.
* @deprecated use {@link XmlPullParser#getQName()} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5
public static QName getQName(XmlPullParser parser) { public static QName getQName(XmlPullParser parser) {
String elementName = parser.getName(); return parser.getQName();
String prefix = parser.getPrefix();
if (prefix == null) {
prefix = XMLConstants.DEFAULT_NS_PREFIX;
}
String namespace = parser.getNamespace();
return new QName(namespace, elementName, prefix);
} }
} }

View file

@ -22,7 +22,6 @@ import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smack.xml.XmlPullParserException;
@ -52,7 +51,7 @@ public class SimplePayload implements ExtensionElement {
catch (XmlPullParserException | IOException e) { catch (XmlPullParserException | IOException e) {
throw new AssertionError(e); throw new AssertionError(e);
} }
QName qname = ParserUtils.getQName(parser); QName qname = parser.getQName();
payload = xmlPayload; payload = xmlPayload;