private Packet parseNextPacketFromPdml ( ) { Packet currentPacket = null ; int eventType ; fieldStack . empty ( ) ; try { eventType = parser . getEventType ( ) ; while ( eventType != XmlPullParser . END_DOCUMENT ) { switch ( eventType ) { case XmlPullParser . START_TAG : if ( parser . getRawName ( ) . contains ( "packet" ) ) { // At packet tag currentPacket = setPacketProperties ( xppFactory . newStartTag ( ) ) ; } else if ( parser . getRawName ( ) . contains ( "proto" ) ) { currentPacket = setProtoProperties ( xppFactory . newStartTag ( ) , currentPacket ) ; } else if ( parser . getRawName ( ) . contains ( "field" ) ) { fieldStack . push ( "field" ) ; // Added http after all others if ( protoStack . peek ( ) . equals ( "http" ) && currentPacket . isTcp ( ) ) { currentPacket = setHttpFieldProperties ( xppFactory . newStartTag ( ) , currentPacket ) ; } else { currentPacket = setFieldProperties ( xppFactory . newStartTag ( ) , currentPacket ) ; } } else { ; } break ; case XmlPullParser . END_TAG : if ( parser . getRawName ( ) . contains ( "packet" ) ) { eventType = parser . next ( ) ; return currentPacket ; } else if ( parser . getRawName ( ) . contains ( "proto" ) ) { protoStack . pop ( ) ; } else if ( parser . getRawName ( ) . contains ( "field" ) ) { fieldStack . pop ( ) ; } default : } eventType = parser . next ( ) ; } return null ; // Returned if at end of pdml } catch ( XmlPullParserException e ) { e . printStackTrace ( ) ; throw new ParserFailureException ( "Failed parsing pmdl " + e ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw new ParserFailureException ( "Failed reading parser.next " + e ) ; } }
Returns the Packet set with all properties that can be read from the pdml