1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +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; package org.jivesoftware.smackx.pubsub;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;
/** /**
@ -41,19 +44,11 @@ public class SubscribeExtension extends NodeExtension {
} }
@Override @Override
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) {
StringBuilder builder = new StringBuilder("<"); XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment);
builder.append(getElementName()); xml.optAttribute("node", getNode());
xml.attribute("jid", getJid());
if (getNode() != null) { xml.closeEmptyElement();
builder.append(" node='"); return xml;
builder.append(getNode());
builder.append('\'');
}
builder.append(" jid='");
builder.append(getJid());
builder.append("'/>");
return builder.toString();
} }
} }