public static Collection < String > parseMechanisms ( XmlPullParser parser ) throws XmlPullParserException , IOException { List < String > mechanisms = new ArrayList < String > ( ) ; boolean done = false ; while ( ! done ) { int eventType = parser . next ( ) ; if ( eventType == XmlPullParser . START_TAG ) { String elementName = parser . getName ( ) ; if ( elementName . equals ( "mechanism" ) ) { mechanisms . add ( parser . nextText ( ) ) ; } } else if ( eventType == XmlPullParser . END_TAG ) { if ( parser . getName ( ) . equals ( "mechanisms" ) ) { done = true ; } } } return mechanisms ; }
Parse the available SASL mechanisms reported from the server .