Source:
public static IQ parseIQ(XmlPullParser parser) throws Exception { ParserUtils.assertAtStartTag(parser); final int initialDepth = parser.getDepth(); IQ iqPacket = null; XMPPError.Builder error = null; final String id = parser.getAttributeValue("", "id"); final Jid to = ParserUtils.getJidAttribute(parser, "to"); final Jid from = ParserUtils.getJidAttribute(parser, "from"); final IQ.Type type = IQ.Type.fromString(parser.getAttributeValue("", "type")); final Map<String, String> customAttributes = ParserUtils.getCustomAttributes(parser); outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: String elementName = parser.getName(); String namespace = parser.getNamespace(); switch(elementName) { case "error": error = PacketParserUtils.parseError(parser); break; default: IQProvider<IQ> provider = ProviderManager.getIQProvider(elementName, namespace); if (provider != null) { iqPacket = provider.parse(parser); } END_TAG first. else { iqPacket = new UnparsedIQ(elementName, namespace, parseElement(parser)); } break; } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } if (iqPacket == null) { switch (type) { case error: iqPacket = new ErrorIQ(error); break; case result: iqPacket = new EmptyResultIQ(); break; default: break; } } iqPacket.setStanzaId(id); iqPacket.setTo(to); iqPacket.setFrom(from); iqPacket.setType(type); iqPacket.setError(error); if (Stanza.isCustomAttributesEnabled()) { iqPacket.setCustomAttributes(customAttributes); } return iqPacket; }

Target:
public static IQ parseIQ(XmlPullParser parser) throws Exception { ParserUtils.assertAtStartTag(parser); final int initialDepth = parser.getDepth(); IQ iqPacket = null; XMPPError.Builder error = null; final String id = parser.getAttributeValue("", "id"); final Jid to = ParserUtils.getJidAttribute(parser, "to"); final Jid from = ParserUtils.getJidAttribute(parser, "from"); final IQ.Type type = IQ.Type.fromString(parser.getAttributeValue("", "type")); Map<String, String> customAttributes = null; if (Stanza.customAttributesEnabled()) { customAttributes = ParserUtils.getCustomAttributes(parser); } outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: String elementName = parser.getName(); String namespace = parser.getNamespace(); switch(elementName) { case "error": error = PacketParserUtils.parseError(parser); break; default: IQProvider<IQ> provider = ProviderManager.getIQProvider(elementName, namespace); if (provider != null) { iqPacket = provider.parse(parser); } END_TAG first. else { iqPacket = new UnparsedIQ(elementName, namespace, parseElement(parser)); } break; } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } if (iqPacket == null) { switch (type) { case error: iqPacket = new ErrorIQ(error); break; case result: iqPacket = new EmptyResultIQ(); break; default: break; } } iqPacket.setStanzaId(id); iqPacket.setTo(to); iqPacket.setFrom(from); iqPacket.setType(type); iqPacket.setError(error); if (Stanza.customAttributesEnabled()) { iqPacket.setCustomAttributes(customAttributes); } return iqPacket; }