Hi,
When I define a very basic IQ stanza and add an RSMSet extension, it is serialized two times:
Query query = new Query(“queryId”);
RSMSet rsmSet = new RSMSet(20);
query.addExtension(rsmSet);
System.out.println(query.toXML().toString());
Will produce the following String with two RSMSets in it:
<?xml version="1.0"?>
<set xmlns="[http://jabber.org/protocol/rsm](http://jabber.org/protocol/rsm)">
20
<set xmlns="[http://jabber.org/protocol/rsm](http://jabber.org/protocol/rsm)">
20
BTW, this was in the Smack 4.1.2-SNAPSHOT release.
Flow
June 24, 2015, 8:18am
3
I guess your Query’s toXML is flawed.
Ahhh yeah actually it is not mine. But the Query-class overrides this method:
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
xml.attribute(“queryid”, this.getQueryID());
xml.rightAngleBracket();
Iterator i$ = this.getExtensions().iterator();
while(i$.hasNext()) {
ExtensionElement p = (ExtensionElement)i$.next();
xml.append(p.toXML());
}
return xml;
}
But the extensions are already added in IQ.getChildElementXML() so should be omitted here.
Thanks,
Andrej
Yes I agree it’s way to generic! It is not open-source so unfortunately I cannot share the source.