powered by Jive Software

Parsing a jabber:iq:last result

Could someone point me in the right direction in how to parse the following result in my provider?

<iq id=''l67'' type=''result'' from=''user@host/resource''>
  <query xmlns=''jabber:iq:last'' seconds=''123''/>
</iq>

Thanks,

Adam

Hey Adam,

I think that something like this will do the trick.

public IQ parseIQ(XmlPullParser parser) throws Exception {
        IQLast iqLast = new IQLast(parser.getAttributeValue("", "seconds"));
        while (!done) {
            int eventType = parser.next();
            if (eventType == XmlPullParser.END_TAG) {
                if (parser.getName().equals("query ")) {
                    done = true;
                }
            }
        }
        return iqLast;

Regards,

– Gato

Yup, that did it.

Thanks !