public static Stanza parseStanza ( XmlPullParser parser , XmlEnvironment outerXmlEnvironment ) throws Exception { ParserUtils . assertAtStartTag ( parser ) ; final String name = parser . getName ( ) ; switch ( name ) { case Message . ELEMENT : return parseMessage ( parser , outerXmlEnvironment ) ; case IQ . IQ_ELEMENT : return parseIQ ( parser , outerXmlEnvironment ) ; case Presence . ELEMENT : return parsePresence ( parser , outerXmlEnvironment ) ; default : throw new IllegalArgumentException ( "Can only parse message, iq or presence, not " + name ) ; } }
Tries to parse and return either a Message IQ or Presence stanza .