@Override
    public Jingle parse(XmlPullParser parser, int intialDepth, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException {

        Jingle jingle = new Jingle();
        String sid = "";
        JingleActionEnum action;
        Jid initiator, responder;
        boolean done = false;
        JingleContent currentContent = null;

        // Sub-elements providers
        JingleContentProvider jcp = new JingleContentProvider();
        JingleDescriptionProvider jdpAudio = new JingleDescriptionProvider.Audio();
        JingleTransportProvider jtpRawUdp = new JingleTransportProvider.RawUdp();
        JingleTransportProvider jtpIce = new JingleTransportProvider.Ice();
        ExtensionElementProvider<?> jmipAudio = new JingleContentInfoProvider.Audio();

        int eventType;
        String elementName;
        String namespace;

        // Get some attributes for the <jingle> element
        sid = parser.getAttributeValue("", "sid");
        action = JingleActionEnum.getAction(parser.getAttributeValue("", "action"));
        initiator = ParserUtils.getJidAttribute(parser, "initiator");
        responder = ParserUtils.getJidAttribute(parser, "responder");

        jingle.setSid(sid);
        jingle.setAction(action);
        jingle.setInitiator(initiator);
        jingle.setResponder(responder);

        // Start processing sub-elements
        while (!done) {
            eventType = parser.next();
            elementName = parser.getName();
            namespace = parser.getNamespace();

            if (eventType == XmlPullParser.START_TAG) {

                // Parse some well know subelements, depending on the namespaces
                // and element names...

                if (elementName.equals(JingleContent.NODENAME)) {
                    // Add a new <content> element to the jingle
                    currentContent = jcp.parse(parser);
                    jingle.addContent(currentContent);
                } else if (elementName.equals(JingleDescription.NODENAME) && namespace.equals(JingleDescription.Audio.NAMESPACE)) {
                    // Set the <description> element of the <content>
                    currentContent.setDescription(jdpAudio.parse(parser));
                } else if (elementName.equals(JingleTransport.NODENAME)) {
                    // Add all of the <transport> elements to the <content> of the jingle

                    // Parse the possible transport namespaces
                    if (namespace.equals(JingleTransport.RawUdp.NAMESPACE)) {
                        currentContent.addJingleTransport(jtpRawUdp.parse(parser));
                    } else if (namespace.equals(JingleTransport.Ice.NAMESPACE)) {
                        currentContent.addJingleTransport(jtpIce.parse(parser));
                    } else {
                        // TODO: Should be SmackParseException.
                        throw new IOException("Unknown transport namespace \"" + namespace + "\" in Jingle packet.");
                    }
                } else if (namespace.equals(JingleContentInfo.Audio.NAMESPACE)) {
                    jingle.setContentInfo((JingleContentInfo) jmipAudio.parse(parser));
                } else {
                    // TODO: Should be SmackParseException.
                    throw new IOException("Unknown combination of namespace \"" + namespace + "\" and element name \""
                            + elementName + "\" in Jingle packet.");
                }

            } else if (eventType == XmlPullParser.END_TAG) {
                if (parser.getName().equals(Jingle.getElementName())) {
                    done = true;
                }
            }
        }

        return jingle;
    }
@ Override public Jingle parse ( XmlPullParser parser , int intialDepth , XmlEnvironment xmlEnvironment ) throws IOException , XmlPullParserException , SmackParsingException { Jingle jingle = new Jingle ( ) ; String sid = "" ; JingleActionEnum action ; Jid initiator , responder ; boolean done = false ; JingleContent currentContent = null ; JingleContentProvider jcp = new JingleContentProvider ( ) ; JingleDescriptionProvider jdpAudio = new JingleDescriptionProvider . Audio ( ) ; JingleTransportProvider jtpRawUdp = new JingleTransportProvider . RawUdp ( ) ; JingleTransportProvider jtpIce = new JingleTransportProvider . Ice ( ) ; ExtensionElementProvider < ? > jmipAudio = new JingleContentInfoProvider . Audio ( ) ; int eventType ; String elementName ; String namespace ; sid = parser . getAttributeValue ( "" , "sid" ) ; action = JingleActionEnum . getAction ( parser . getAttributeValue ( "" , "action" ) ) ; initiator = ParserUtils . getJidAttribute ( parser , "initiator" ) ; responder = ParserUtils . getJidAttribute ( parser , "responder" ) ; jingle . setSid ( sid ) ; jingle . setAction ( action ) ; jingle . setInitiator ( initiator ) ; jingle . setResponder ( responder ) ; while ( ! done ) { eventType = parser . next ( ) ; elementName = parser . getName ( ) ; namespace = parser . getNamespace ( ) ; if ( eventType == XmlPullParser . START_TAG ) { if ( elementName . equals ( JingleContent . NODENAME ) ) { currentContent = jcp . parse ( parser ) ; jingle . addContent ( currentContent ) ; } else if ( elementName . equals ( JingleDescription . NODENAME ) && namespace . equals ( JingleDescription . Audio . NAMESPACE ) ) { currentContent . setDescription ( jdpAudio . parse ( parser ) ) ; } else if ( elementName . equals ( JingleTransport . NODENAME ) ) { if ( namespace . equals ( JingleTransport . RawUdp . NAMESPACE ) ) { currentContent . addJingleTransport ( jtpRawUdp . parse ( parser ) ) ; } else if ( namespace . equals ( JingleTransport . Ice . NAMESPACE ) ) { currentContent . addJingleTransport ( jtpIce . parse ( parser ) ) ; } else { throw new IOException ( "Unknown transport namespace \"" + namespace + "\" in Jingle packet." ) ; } } else if ( namespace . equals ( JingleContentInfo . Audio . NAMESPACE ) ) { jingle . setContentInfo ( ( JingleContentInfo ) jmipAudio . parse ( parser ) ) ; } else { throw new IOException ( "Unknown combination of namespace \"" + namespace + "\" and element name \"" + elementName + "\" in Jingle packet." ) ; } } else if ( eventType == XmlPullParser . END_TAG ) { if ( parser . getName ( ) . equals ( Jingle . getElementName ( ) ) ) { done = true ; } } } return jingle ; }
Parse a iq/jingle element.
@throws XmlPullParserException
@throws IOException
@throws SmackParsingException