I’m using smack 4.1.4, and I’m having trouble parsing an IQ Error stanza.
According to the spec @ Extensible Messaging and Presence Protocol (XMPP): Core an error stanza is of the form …
[RECOMMENDED to include sender XML here]
<defined-condition xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='langcode'>
OPTIONAL descriptive text
</text>
[OPTIONAL application-specific condition element]
So, I’ve got two packets which may look something like …
A standard result IQ stanza looks something like …
… rest of result XML …
<error …
Whilst an error IQ stanza looks very similar (as it includes the sender XML)
… rest of sender XML …
<error …
And I can’t work out how to write a IQProvider for it. My problem is that there’s no way in advance of knowing if it’s an error or result IQ; the IQProvider class that I’m extending doesn’t give me access to the parent element, so I can’t check the IQ type attribute. If I read the next item after the end of the command tag to see if it’s an , then for the result IQ stanza I’ve just pulled the item and the Provider.parse() blows up when it calls ParserUtils.forwardToEndTagOfDepth(…) as we’ve gone too far already.
I’m sure it must be possible to properly parse an error IQ of this style, but I can’t figure out - can someone point me in the right direction?
Thanks,
Greg