Hi am using smack 4.3.4. I have made one custom xml. When am parsing the incoming custom IQ in success case it working fine.
But when am throwing some error in XML for failure case
<iq type="error" id="LGmcR-64" from="example.com" to="learn@example.com/Miranda">
<query xmlns="com:example:check#request" />
<error code="404" type="cancel">
<item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
</error>
</iq>
am getting error.
Smack message parsing exception. Content: '<query xmlns='com:example:check#request'></query><error xmlns='jabber:client' code='404' type='cancel'><item-not-found/></error></iq>'
am handling with custom IQ query by:
public class IQUserCustomParamProvider extends IQProvider {
@Override
public CheckQuery parse(XmlPullParser parser, int initialDepth) throws Exception {
CheckQuery query = new CheckQuery();
if (parser.getAttributeName(0) != null && parser.getAttributeName(0).equals("status")) {
query.setStatus(parser.getAttributeValue(0));
}
if (parser.getAttributeName(1) != null && parser.getAttributeName(1).equals("token")) {
query.setToken(parser.getAttributeValue(1));
}
return query;
}
}
I have used one more way
PacketParserUtils.parseStanza(parser);
But it throw exception that it can handle iq, presence, message not query
How to parse that error case xml? anybody have Idea how to parse xml in IQProvider extended class?