public static Destroy parseDestroy(XmlPullParser parser) throws XmlPullParserException, IOException { boolean done = false; Destroy destroy = new Destroy(); destroy.setJid(parser.getAttributeValue("", "jid")); while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("reason")) { destroy.setReason(parser.nextText()); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("destroy")) { done = true; } } } return destroy; }