From 1448fa46328a11d467fd3792f49b186d0042c682 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 17 Jun 2017 11:42:09 +0200 Subject: [PATCH] Add ParserUtils.getXmlLang(XmlPullParser) and add TODO comment to PacketParserUtils.getLanguageAttribute(). --- .../java/org/jivesoftware/smack/util/PacketParserUtils.java | 2 ++ .../main/java/org/jivesoftware/smack/util/ParserUtils.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java index 35ca0c17a..02a6c96a3 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java @@ -976,6 +976,8 @@ public class PacketParserUtils { return new Session.Feature(optional); } + + // TODO Remove this static method and use ParserUtils.getXmlLang(XmlPullParser) instead. private static String getLanguageAttribute(XmlPullParser parser) { // CHECKSTYLE:OFF for (int i = 0; i < parser.getAttributeCount(); i++) { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java index 01f47aa9f..14a003a21 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java @@ -251,4 +251,9 @@ public class ParserUtils { } return text; } + + public static String getXmlLang(XmlPullParser parser) { + String langString = parser.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang"); + return langString; + } }