Package org.jivesoftware.smack.util
Class ParserUtils
java.lang.Object
org.jivesoftware.smack.util.ParserUtils
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertAtEndTag
(XmlPullParser parser) static void
assertAtStartTag
(XmlPullParser parser) static void
assertAtStartTag
(XmlPullParser parser, String name) static void
forwardToEndTagOfDepth
(XmlPullParser parser, int depth) static void
forwardToStartElement
(XmlPullParser parser) static EntityBareJid
getBareJidAttribute
(XmlPullParser parser) static EntityBareJid
getBareJidAttribute
(XmlPullParser parser, String name) static Boolean
getBooleanAttribute
(XmlPullParser parser, String name) Get the boolean value of an argument.static boolean
getBooleanAttribute
(XmlPullParser parser, String name, boolean defaultValue) static Byte
static Date
getDateFromNextText
(XmlPullParser parser) static Date
getDateFromOptionalXep82String
(String dateString) static Date
getDateFromString
(String dateString) static Date
getDateFromXep82String
(String dateString) static Double
getDoubleAttribute
(XmlPullParser parser, String name) static double
getDoubleAttribute
(XmlPullParser parser, String name, long defaultValue) static double
getDoubleFromNextText
(XmlPullParser parser) static EntityJid
getEntityJidAttribute
(XmlPullParser parser, String name) static EntityFullJid
getFullJidAttribute
(XmlPullParser parser) static EntityFullJid
getFullJidAttribute
(XmlPullParser parser, String name) static Integer
getIntegerAttribute
(XmlPullParser parser, String name) static int
getIntegerAttribute
(XmlPullParser parser, String name, int defaultValue) static int
getIntegerAttributeOrThrow
(XmlPullParser parser, String name, String throwMessage) static int
getIntegerFromNextText
(XmlPullParser parser) static InternetAddress
getInternetAddressIngoringZoneIdAttribute
(XmlPullParser parser, String attribute) static Jid
getJidAttribute
(XmlPullParser parser) static Jid
getJidAttribute
(XmlPullParser parser, String name) static Long
getLongAttribute
(XmlPullParser parser, String name) static long
getLongAttribute
(XmlPullParser parser, String name, long defaultValue) static String
getRequiredAttribute
(XmlPullParser parser, String name) static String
getRequiredNextText
(XmlPullParser parser) static UInt16
getRequiredUInt16Attribute
(XmlPullParser parser, String name) static Resourcepart
getResourcepartAttribute
(XmlPullParser parser, String name) static Short
getShortAttribute
(XmlPullParser parser, String name) static short
getShortAttribute
(XmlPullParser parser, String name, short defaultValue) static UInt16
getUInt16Attribute
(XmlPullParser parser, String name) static UInt32
getUInt32Attribute
(XmlPullParser parser, String name) static URI
getUriFromNextText
(XmlPullParser parser) static String
getXmlLang
(XmlPullParser parser) static String
getXmlLang
(XmlPullParser parser, XmlEnvironment xmlEnvironment) static boolean
parseXmlBoolean
(String booleanString) Phrase a string to a boolean value as per "xs:boolean".
-
Field Details
-
JID
The constant String "jid".- See Also:
-
-
Constructor Details
-
ParserUtils
public ParserUtils()
-
-
Method Details
-
assertAtStartTag
- Throws:
XmlPullParserException
-
assertAtStartTag
public static void assertAtStartTag(XmlPullParser parser, String name) throws XmlPullParserException - Throws:
XmlPullParserException
-
assertAtEndTag
- Throws:
XmlPullParserException
-
forwardToStartElement
public static void forwardToStartElement(XmlPullParser parser) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
forwardToEndTagOfDepth
public static void forwardToEndTagOfDepth(XmlPullParser parser, int depth) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
getJidAttribute
- Throws:
XmppStringprepException
-
getJidAttribute
- Throws:
XmppStringprepException
-
getBareJidAttribute
public static EntityBareJid getBareJidAttribute(XmlPullParser parser) throws XmppStringprepException - Throws:
XmppStringprepException
-
getBareJidAttribute
public static EntityBareJid getBareJidAttribute(XmlPullParser parser, String name) throws XmppStringprepException - Throws:
XmppStringprepException
-
getFullJidAttribute
public static EntityFullJid getFullJidAttribute(XmlPullParser parser) throws XmppStringprepException - Throws:
XmppStringprepException
-
getFullJidAttribute
public static EntityFullJid getFullJidAttribute(XmlPullParser parser, String name) throws XmppStringprepException - Throws:
XmppStringprepException
-
getEntityJidAttribute
public static EntityJid getEntityJidAttribute(XmlPullParser parser, String name) throws XmppStringprepException - Throws:
XmppStringprepException
-
getResourcepartAttribute
public static Resourcepart getResourcepartAttribute(XmlPullParser parser, String name) throws XmppStringprepException - Throws:
XmppStringprepException
-
parseXmlBoolean
Phrase a string to a boolean value as per "xs:boolean". Valid input strings are "true", "1" for true, and "false", "0" for false.- Parameters:
booleanString
- the input string.- Returns:
- the boolean representation of the input string
- Throws:
IllegalArgumentException
- if the input string is not valid.- Since:
- 4.3.2
-
getBooleanAttribute
Get the boolean value of an argument.- Parameters:
parser
- TODO javadoc me pleasename
- TODO javadoc me please- Returns:
- the boolean value or null of no argument of the given name exists
-
getBooleanAttribute
-
getByteAttributeFromNextText
public static Byte getByteAttributeFromNextText(XmlPullParser parser) throws IOException, XmlPullParserException - Throws:
IOException
XmlPullParserException
-
getIntegerAttributeOrThrow
public static int getIntegerAttributeOrThrow(XmlPullParser parser, String name, String throwMessage) throws IOException - Throws:
IOException
-
getIntegerAttribute
-
getIntegerAttribute
-
getUInt16Attribute
-
getRequiredUInt16Attribute
public static UInt16 getRequiredUInt16Attribute(XmlPullParser parser, String name) throws SmackParsingException.RequiredAttributeMissingException -
getIntegerFromNextText
public static int getIntegerFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
getLongAttribute
-
getLongAttribute
-
getUInt32Attribute
-
getDoubleFromNextText
public static double getDoubleFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
getDoubleAttribute
-
getDoubleAttribute
-
getShortAttribute
-
getShortAttribute
-
getDateFromOptionalXep82String
- Throws:
ParseException
-
getDateFromXep82String
- Throws:
ParseException
-
getDateFromString
- Throws:
ParseException
-
getDateFromNextText
public static Date getDateFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException -
getUriFromNextText
public static URI getUriFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException.SmackUriSyntaxParsingException -
getRequiredAttribute
- Throws:
IOException
-
getRequiredNextText
public static String getRequiredNextText(XmlPullParser parser) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
getXmlLang
-
getXmlLang
-
getInternetAddressIngoringZoneIdAttribute
public static InternetAddress getInternetAddressIngoringZoneIdAttribute(XmlPullParser parser, String attribute)
-