1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 12:02:05 +01:00

Use XmlStringBuilder in PubSub's SubscribeExtension

This commit is contained in:
Florian Schmaus 2019-07-05 11:31:12 +02:00
parent 9c0da3ed07
commit fda9408cf3

View file

@ -16,6 +16,9 @@
*/
package org.jivesoftware.smackx.pubsub;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jxmpp.jid.Jid;
/**
@ -41,19 +44,11 @@ public class SubscribeExtension extends NodeExtension {
}
@Override
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
StringBuilder builder = new StringBuilder("<");
builder.append(getElementName());
if (getNode() != null) {
builder.append(" node='");
builder.append(getNode());
builder.append('\'');
}
builder.append(" jid='");
builder.append(getJid());
builder.append("'/>");
return builder.toString();
public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) {
XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment);
xml.optAttribute("node", getNode());
xml.attribute("jid", getJid());
xml.closeEmptyElement();
return xml;
}
}