PE getExtension(PubSubElementType elem) {
return (PE) getExtension(elem.getElementName(), elem.getNamespace().getXmlns());
}
/**
* Returns the XML representation of a pubsub element according the specification.
*
* The XML representation will be inside of an iq stanza like
* in the following example:
*
* <iq type='set' id="MlIpV-4" to="pubsub.gato.home" from="gato3@gato.home/Smack">
* <pubsub xmlns="http://jabber.org/protocol/pubsub">
* :
* Specific request extension
* :
* </pubsub>
* </iq>
*
*
*/
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
// N.B. We could use SimpleIQ here, but PubSub IQs will nearly *always* have packet extensions, which means that
// SimpleIQs xml.setEmptyElement() is counter-productive in this case and we use xml.rightAngleBracket()
// instead, as there are likely sub-elements to follow.
xml.rightAngleBracket();
return xml;
}
public static PubSub createPubsubPacket(Jid to, Type type, ExtensionElement extension, PubSubNamespace ns) {
PubSub pubSub = new PubSub(to, type, ns);
pubSub.addExtension(extension);
return pubSub;
}
}