Class ParserUtils

java.lang.Object
org.jivesoftware.smack.util.ParserUtils

public class ParserUtils extends Object
  • Field Details

  • Constructor Details

    • ParserUtils

      public ParserUtils()
  • Method Details

    • assertAtStartTag

      public static void assertAtStartTag(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jivesoftware.smack.xml.XmlPullParserException
      Throws:
      org.jivesoftware.smack.xml.XmlPullParserException
    • assertAtStartTag

      public static void assertAtStartTag(org.jivesoftware.smack.xml.XmlPullParser parser, String name) throws org.jivesoftware.smack.xml.XmlPullParserException
      Throws:
      org.jivesoftware.smack.xml.XmlPullParserException
    • assertAtEndTag

      public static void assertAtEndTag(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jivesoftware.smack.xml.XmlPullParserException
      Throws:
      org.jivesoftware.smack.xml.XmlPullParserException
    • forwardToStartElement

      public static void forwardToStartElement(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jivesoftware.smack.xml.XmlPullParserException, IOException
      Throws:
      org.jivesoftware.smack.xml.XmlPullParserException
      IOException
    • forwardToEndTagOfDepth

      public static void forwardToEndTagOfDepth(org.jivesoftware.smack.xml.XmlPullParser parser, int depth) throws org.jivesoftware.smack.xml.XmlPullParserException, IOException
      Throws:
      org.jivesoftware.smack.xml.XmlPullParserException
      IOException
    • getJidAttribute

      public static org.jxmpp.jid.Jid getJidAttribute(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jxmpp.stringprep.XmppStringprepException
      Throws:
      org.jxmpp.stringprep.XmppStringprepException
    • getJidAttribute

      public static org.jxmpp.jid.Jid getJidAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name) throws org.jxmpp.stringprep.XmppStringprepException
      Throws:
      org.jxmpp.stringprep.XmppStringprepException
    • getBareJidAttribute

      public static org.jxmpp.jid.EntityBareJid getBareJidAttribute(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jxmpp.stringprep.XmppStringprepException
      Throws:
      org.jxmpp.stringprep.XmppStringprepException
    • getBareJidAttribute

      public static org.jxmpp.jid.EntityBareJid getBareJidAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name) throws org.jxmpp.stringprep.XmppStringprepException
      Throws:
      org.jxmpp.stringprep.XmppStringprepException
    • getFullJidAttribute

      public static org.jxmpp.jid.EntityFullJid getFullJidAttribute(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jxmpp.stringprep.XmppStringprepException
      Throws:
      org.jxmpp.stringprep.XmppStringprepException
    • getFullJidAttribute

      public static org.jxmpp.jid.EntityFullJid getFullJidAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name) throws org.jxmpp.stringprep.XmppStringprepException
      Throws:
      org.jxmpp.stringprep.XmppStringprepException
    • getEntityJidAttribute

      public static org.jxmpp.jid.EntityJid getEntityJidAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name) throws org.jxmpp.stringprep.XmppStringprepException
      Throws:
      org.jxmpp.stringprep.XmppStringprepException
    • getResourcepartAttribute

      public static org.jxmpp.jid.parts.Resourcepart getResourcepartAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name) throws org.jxmpp.stringprep.XmppStringprepException
      Throws:
      org.jxmpp.stringprep.XmppStringprepException
    • parseXmlBoolean

      public static boolean parseXmlBoolean(String booleanString)
      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

      public static Boolean getBooleanAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name)
      Get the boolean value of an argument.
      Parameters:
      parser - TODO javadoc me please
      name - TODO javadoc me please
      Returns:
      the boolean value or null of no argument of the given name exists
    • getBooleanAttribute

      public static boolean getBooleanAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name, boolean defaultValue)
    • getByteAttributeFromNextText

      public static Byte getByteAttributeFromNextText(org.jivesoftware.smack.xml.XmlPullParser parser) throws IOException, org.jivesoftware.smack.xml.XmlPullParserException
      Throws:
      IOException
      org.jivesoftware.smack.xml.XmlPullParserException
    • getIntegerAttributeOrThrow

      public static int getIntegerAttributeOrThrow(org.jivesoftware.smack.xml.XmlPullParser parser, String name, String throwMessage) throws IOException
      Throws:
      IOException
    • getIntegerAttribute

      public static Integer getIntegerAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name)
    • getIntegerAttribute

      public static int getIntegerAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name, int defaultValue)
    • getUInt16Attribute

      public static UInt16 getUInt16Attribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name)
    • getRequiredUInt16Attribute

      public static UInt16 getRequiredUInt16Attribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name) throws SmackParsingException.RequiredAttributeMissingException
      Throws:
      SmackParsingException.RequiredAttributeMissingException
    • getIntegerFromNextText

      public static int getIntegerFromNextText(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jivesoftware.smack.xml.XmlPullParserException, IOException
      Throws:
      org.jivesoftware.smack.xml.XmlPullParserException
      IOException
    • getLongAttribute

      public static Long getLongAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name)
    • getLongAttribute

      public static long getLongAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name, long defaultValue)
    • getUInt32Attribute

      public static UInt32 getUInt32Attribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name)
    • getDoubleFromNextText

      public static double getDoubleFromNextText(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jivesoftware.smack.xml.XmlPullParserException, IOException
      Throws:
      org.jivesoftware.smack.xml.XmlPullParserException
      IOException
    • getDoubleAttribute

      public static Double getDoubleAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name)
    • getDoubleAttribute

      public static double getDoubleAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name, long defaultValue)
    • getShortAttribute

      public static Short getShortAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name)
    • getShortAttribute

      public static short getShortAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name, short defaultValue)
    • getDateFromOptionalXep82String

      public static Date getDateFromOptionalXep82String(String dateString) throws ParseException
      Throws:
      ParseException
    • getDateFromXep82String

      public static Date getDateFromXep82String(String dateString) throws ParseException
      Throws:
      ParseException
    • getDateFromString

      public static Date getDateFromString(String dateString) throws ParseException
      Throws:
      ParseException
    • getDateFromNextText

      public static Date getDateFromNextText(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jivesoftware.smack.xml.XmlPullParserException, IOException, ParseException
      Throws:
      org.jivesoftware.smack.xml.XmlPullParserException
      IOException
      ParseException
    • getUriFromNextText

      public static URI getUriFromNextText(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jivesoftware.smack.xml.XmlPullParserException, IOException, SmackParsingException.SmackUriSyntaxParsingException
      Throws:
      org.jivesoftware.smack.xml.XmlPullParserException
      IOException
      SmackParsingException.SmackUriSyntaxParsingException
    • getRequiredAttribute

      public static String getRequiredAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String name) throws IOException
      Throws:
      IOException
    • getRequiredNextText

      public static String getRequiredNextText(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jivesoftware.smack.xml.XmlPullParserException, IOException
      Throws:
      org.jivesoftware.smack.xml.XmlPullParserException
      IOException
    • getXmlLang

      public static String getXmlLang(org.jivesoftware.smack.xml.XmlPullParser parser, XmlEnvironment xmlEnvironment)
    • getXmlLang

      public static String getXmlLang(org.jivesoftware.smack.xml.XmlPullParser parser)
    • getInternetAddressIngoringZoneIdAttribute

      public static InternetAddress getInternetAddressIngoringZoneIdAttribute(org.jivesoftware.smack.xml.XmlPullParser parser, String attribute)