public static PacketExtension parsePacketExtension ( String elementName , String namespace , XmlPullParser parser ) throws Exception { DefaultPacketExtension extension = new DefaultPacketExtension ( elementName , namespace ) ; boolean done = false ; while ( ! done ) { int eventType = parser . next ( ) ; if ( eventType == XmlPullParser . START_TAG ) { String name = parser . getName ( ) ; // If an empty element, set the value with the empty string. if ( parser . isEmptyElementTag ( ) ) { extension . setValue ( name , "" ) ; } // Otherwise, get the the element text. else { eventType = parser . next ( ) ; if ( eventType == XmlPullParser . TEXT ) { String value = parser . getText ( ) ; extension . setValue ( name , value ) ; } } } else if ( eventType == XmlPullParser . END_TAG ) { if ( parser . getName ( ) . equals ( elementName ) ) { done = true ; } } } return extension ; }
Parses a packet extension sub - packet .