mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22:05 +01:00
Use XmlStringBuilder for pubsub.Subscription
This commit is contained in:
parent
2e4ce965cd
commit
ffaca31178
1 changed files with 10 additions and 13 deletions
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.pubsub;
|
package org.jivesoftware.smackx.pubsub;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a subscription to node for both requests and replies.
|
* Represents a subscription to node for both requests and replies.
|
||||||
*
|
*
|
||||||
|
@ -134,22 +136,17 @@ public class Subscription extends NodeExtension
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML()
|
public XmlStringBuilder toXML()
|
||||||
{
|
{
|
||||||
StringBuilder builder = new StringBuilder("<subscription");
|
XmlStringBuilder builder = new XmlStringBuilder(this);
|
||||||
appendAttribute(builder, "jid", jid);
|
builder.attribute("jid", jid);
|
||||||
|
|
||||||
if (getNode() != null)
|
builder.optAttribute("node", getNode());
|
||||||
appendAttribute(builder, "node", getNode());
|
builder.optAttribute("subid", id);
|
||||||
|
builder.optAttribute("subscription", state.toString());
|
||||||
|
|
||||||
if (id != null)
|
builder.closeEmptyElement();
|
||||||
appendAttribute(builder, "subid", id);
|
return builder;
|
||||||
|
|
||||||
if (state != null)
|
|
||||||
appendAttribute(builder, "subscription", state.toString());
|
|
||||||
|
|
||||||
builder.append("/>");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void appendAttribute(StringBuilder builder, String att, String value)
|
private static void appendAttribute(StringBuilder builder, String att, String value)
|
||||||
|
|
Loading…
Reference in a new issue