Package org.jivesoftware.smack.util
Class ParserUtils
- java.lang.Object
-
- org.jivesoftware.smack.util.ParserUtils
-
public class ParserUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
JID
The constant String "jid".
-
Constructor Summary
Constructors Constructor Description ParserUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
assertAtEndTag(XmlPullParser parser)
static void
assertAtStartTag(XmlPullParser parser)
static void
assertAtStartTag(XmlPullParser parser, java.lang.String name)
static void
forwardToEndTagOfDepth(XmlPullParser parser, int depth)
static void
forwardToStartElement(XmlPullParser parser)
static EntityBareJid
getBareJidAttribute(XmlPullParser parser)
static EntityBareJid
getBareJidAttribute(XmlPullParser parser, java.lang.String name)
static java.lang.Boolean
getBooleanAttribute(XmlPullParser parser, java.lang.String name)
Get the boolean value of an argument.static boolean
getBooleanAttribute(XmlPullParser parser, java.lang.String name, boolean defaultValue)
static java.lang.Byte
getByteAttributeFromNextText(XmlPullParser parser)
static java.util.Date
getDateFromNextText(XmlPullParser parser)
static java.util.Date
getDateFromOptionalXep82String(java.lang.String dateString)
static java.util.Date
getDateFromString(java.lang.String dateString)
static java.util.Date
getDateFromXep82String(java.lang.String dateString)
static java.lang.Double
getDoubleAttribute(XmlPullParser parser, java.lang.String name)
static double
getDoubleAttribute(XmlPullParser parser, java.lang.String name, long defaultValue)
static double
getDoubleFromNextText(XmlPullParser parser)
static EntityJid
getEntityJidAttribute(XmlPullParser parser, java.lang.String name)
static EntityFullJid
getFullJidAttribute(XmlPullParser parser)
static EntityFullJid
getFullJidAttribute(XmlPullParser parser, java.lang.String name)
static java.lang.Integer
getIntegerAttribute(XmlPullParser parser, java.lang.String name)
static int
getIntegerAttribute(XmlPullParser parser, java.lang.String name, int defaultValue)
static int
getIntegerAttributeOrThrow(XmlPullParser parser, java.lang.String name, java.lang.String throwMessage)
static int
getIntegerFromNextText(XmlPullParser parser)
static InternetAddress
getInternetAddressIngoringZoneIdAttribute(XmlPullParser parser, java.lang.String attribute)
static Jid
getJidAttribute(XmlPullParser parser)
static Jid
getJidAttribute(XmlPullParser parser, java.lang.String name)
static java.lang.Long
getLongAttribute(XmlPullParser parser, java.lang.String name)
static long
getLongAttribute(XmlPullParser parser, java.lang.String name, long defaultValue)
static javax.xml.namespace.QName
getQName(XmlPullParser parser)
Deprecated.useXmlPullParser.getQName()
instead.static java.lang.String
getRequiredAttribute(XmlPullParser parser, java.lang.String name)
static java.lang.String
getRequiredNextText(XmlPullParser parser)
static UInt16
getRequiredUInt16Attribute(XmlPullParser parser, java.lang.String name)
static Resourcepart
getResourcepartAttribute(XmlPullParser parser, java.lang.String name)
static java.lang.Short
getShortAttribute(XmlPullParser parser, java.lang.String name)
static short
getShortAttribute(XmlPullParser parser, java.lang.String name, short defaultValue)
static UInt16
getUInt16Attribute(XmlPullParser parser, java.lang.String name)
static UInt32
getUInt32Attribute(XmlPullParser parser, java.lang.String name)
static java.net.URI
getUriFromNextText(XmlPullParser parser)
static java.lang.String
getXmlLang(XmlPullParser parser)
static java.lang.String
getXmlLang(XmlPullParser parser, XmlEnvironment xmlEnvironment)
static boolean
parseXmlBoolean(java.lang.String booleanString)
Prase a string to a boolean value as per "xs:boolean".
-
-
-
Field Detail
-
JID
public static final java.lang.String JID
The constant String "jid".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ParserUtils
public ParserUtils()
-
-
Method Detail
-
assertAtStartTag
public static void assertAtStartTag(XmlPullParser parser) throws XmlPullParserException
- Throws:
XmlPullParserException
-
assertAtStartTag
public static void assertAtStartTag(XmlPullParser parser, java.lang.String name) throws XmlPullParserException
- Throws:
XmlPullParserException
-
assertAtEndTag
public static void assertAtEndTag(XmlPullParser parser) throws XmlPullParserException
- Throws:
XmlPullParserException
-
forwardToStartElement
public static void forwardToStartElement(XmlPullParser parser) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
forwardToEndTagOfDepth
public static void forwardToEndTagOfDepth(XmlPullParser parser, int depth) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
getJidAttribute
public static Jid getJidAttribute(XmlPullParser parser) throws XmppStringprepException
- Throws:
XmppStringprepException
-
getJidAttribute
public static Jid getJidAttribute(XmlPullParser parser, java.lang.String name) throws XmppStringprepException
- Throws:
XmppStringprepException
-
getBareJidAttribute
public static EntityBareJid getBareJidAttribute(XmlPullParser parser) throws XmppStringprepException
- Throws:
XmppStringprepException
-
getBareJidAttribute
public static EntityBareJid getBareJidAttribute(XmlPullParser parser, java.lang.String name) throws XmppStringprepException
- Throws:
XmppStringprepException
-
getFullJidAttribute
public static EntityFullJid getFullJidAttribute(XmlPullParser parser) throws XmppStringprepException
- Throws:
XmppStringprepException
-
getFullJidAttribute
public static EntityFullJid getFullJidAttribute(XmlPullParser parser, java.lang.String name) throws XmppStringprepException
- Throws:
XmppStringprepException
-
getEntityJidAttribute
public static EntityJid getEntityJidAttribute(XmlPullParser parser, java.lang.String name) throws XmppStringprepException
- Throws:
XmppStringprepException
-
getResourcepartAttribute
public static Resourcepart getResourcepartAttribute(XmlPullParser parser, java.lang.String name) throws XmppStringprepException
- Throws:
XmppStringprepException
-
parseXmlBoolean
public static boolean parseXmlBoolean(java.lang.String booleanString)
Prase 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:
java.lang.IllegalArgumentException
- if the input string is not valid.- Since:
- 4.3.2
-
getBooleanAttribute
public static java.lang.Boolean getBooleanAttribute(XmlPullParser parser, java.lang.String name)
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
public static boolean getBooleanAttribute(XmlPullParser parser, java.lang.String name, boolean defaultValue)
-
getByteAttributeFromNextText
public static java.lang.Byte getByteAttributeFromNextText(XmlPullParser parser) throws java.io.IOException, XmlPullParserException
- Throws:
java.io.IOException
XmlPullParserException
-
getIntegerAttributeOrThrow
public static int getIntegerAttributeOrThrow(XmlPullParser parser, java.lang.String name, java.lang.String throwMessage) throws java.io.IOException
- Throws:
java.io.IOException
-
getIntegerAttribute
public static java.lang.Integer getIntegerAttribute(XmlPullParser parser, java.lang.String name)
-
getIntegerAttribute
public static int getIntegerAttribute(XmlPullParser parser, java.lang.String name, int defaultValue)
-
getUInt16Attribute
public static UInt16 getUInt16Attribute(XmlPullParser parser, java.lang.String name)
-
getRequiredUInt16Attribute
public static UInt16 getRequiredUInt16Attribute(XmlPullParser parser, java.lang.String name) throws SmackParsingException.RequiredAttributeMissingException
-
getIntegerFromNextText
public static int getIntegerFromNextText(XmlPullParser parser) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
getLongAttribute
public static java.lang.Long getLongAttribute(XmlPullParser parser, java.lang.String name)
-
getLongAttribute
public static long getLongAttribute(XmlPullParser parser, java.lang.String name, long defaultValue)
-
getUInt32Attribute
public static UInt32 getUInt32Attribute(XmlPullParser parser, java.lang.String name)
-
getDoubleFromNextText
public static double getDoubleFromNextText(XmlPullParser parser) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
getDoubleAttribute
public static java.lang.Double getDoubleAttribute(XmlPullParser parser, java.lang.String name)
-
getDoubleAttribute
public static double getDoubleAttribute(XmlPullParser parser, java.lang.String name, long defaultValue)
-
getShortAttribute
public static java.lang.Short getShortAttribute(XmlPullParser parser, java.lang.String name)
-
getShortAttribute
public static short getShortAttribute(XmlPullParser parser, java.lang.String name, short defaultValue)
-
getDateFromOptionalXep82String
public static java.util.Date getDateFromOptionalXep82String(java.lang.String dateString) throws SmackParsingException.SmackTextParseException
-
getDateFromXep82String
public static java.util.Date getDateFromXep82String(java.lang.String dateString) throws SmackParsingException.SmackTextParseException
-
getDateFromString
public static java.util.Date getDateFromString(java.lang.String dateString) throws SmackParsingException.SmackTextParseException
-
getDateFromNextText
public static java.util.Date getDateFromNextText(XmlPullParser parser) throws XmlPullParserException, java.io.IOException, SmackParsingException.SmackTextParseException
- Throws:
XmlPullParserException
java.io.IOException
SmackParsingException.SmackTextParseException
-
getUriFromNextText
public static java.net.URI getUriFromNextText(XmlPullParser parser) throws XmlPullParserException, java.io.IOException, SmackParsingException.SmackUriSyntaxParsingException
- Throws:
XmlPullParserException
java.io.IOException
SmackParsingException.SmackUriSyntaxParsingException
-
getRequiredAttribute
public static java.lang.String getRequiredAttribute(XmlPullParser parser, java.lang.String name) throws java.io.IOException
- Throws:
java.io.IOException
-
getRequiredNextText
public static java.lang.String getRequiredNextText(XmlPullParser parser) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
getXmlLang
public static java.lang.String getXmlLang(XmlPullParser parser, XmlEnvironment xmlEnvironment)
-
getXmlLang
public static java.lang.String getXmlLang(XmlPullParser parser)
-
getQName
@Deprecated public static javax.xml.namespace.QName getQName(XmlPullParser parser)
Deprecated.useXmlPullParser.getQName()
instead.Get the QName of the current element.- Parameters:
parser
- the parser.- Returns:
- the Qname.
-
getInternetAddressIngoringZoneIdAttribute
public static InternetAddress getInternetAddressIngoringZoneIdAttribute(XmlPullParser parser, java.lang.String attribute)
-
-