Search in sources :

Example 1 with JingleContentDescription

use of org.jivesoftware.smackx.jingleold.packet.JingleContentDescription in project Smack by igniterealtime.

the class JingleContentDescriptionProvider method parse.

/**
     * Parse a iq/jingle/description element.
     *
     * @param parser the input to parse
     * @return a description element
     * @throws IOException 
     * @throws XmlPullParserException 
     * @throws SmackException 
     */
@Override
public JingleContentDescription parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException {
    boolean done = false;
    JingleContentDescription desc = getInstance();
    while (!done) {
        int eventType = parser.next();
        String name = parser.getName();
        if (eventType == XmlPullParser.START_TAG) {
            if (name.equals(JingleContentDescription.JinglePayloadType.NODENAME)) {
                desc.addJinglePayloadType(parsePayload(parser));
            } else {
                throw new SmackException("Unknow element \"" + name + "\" in content.");
            }
        } else if (eventType == XmlPullParser.END_TAG) {
            if (name.equals(JingleContentDescription.NODENAME)) {
                done = true;
            }
        }
    }
    return desc;
}
Also used : JingleContentDescription(org.jivesoftware.smackx.jingleold.packet.JingleContentDescription) SmackException(org.jivesoftware.smack.SmackException)

Aggregations

SmackException (org.jivesoftware.smack.SmackException)1 JingleContentDescription (org.jivesoftware.smackx.jingleold.packet.JingleContentDescription)1