use of org.jivesoftware.smack.util.XmlStringBuilder in project Smack by igniterealtime.
the class IoTDataField method toXML.
@Override
public final XmlStringBuilder toXML() {
XmlStringBuilder xml = new XmlStringBuilder(this);
xml.attribute("name", name).attribute("value", getValueString());
// TODO handle 'unit' attribute as special case if <numeric/> is implemented.
xml.closeEmptyElement();
return xml;
}
use of org.jivesoftware.smack.util.XmlStringBuilder in project Smack by igniterealtime.
the class Presence method toXML.
@Override
public XmlStringBuilder toXML() {
XmlStringBuilder buf = new XmlStringBuilder();
buf.halfOpenElement(ELEMENT);
addCommonAttributes(buf);
if (type != Type.available) {
buf.attribute("type", type);
}
buf.rightAngleBracket();
buf.optElement("status", status);
if (priority != Integer.MIN_VALUE) {
buf.element("priority", Integer.toString(priority));
}
if (mode != null && mode != Mode.available) {
buf.element("show", mode);
}
buf.append(getExtensionsXML());
// Add the error sub-packet, if there is one.
appendErrorIfExists(buf);
buf.closeElement(ELEMENT);
return buf;
}
use of org.jivesoftware.smack.util.XmlStringBuilder in project Smack by igniterealtime.
the class StandardExtensionElement method toXML.
public XmlStringBuilder toXML(String enclosingNamespace) {
if (xmlCache != null) {
return xmlCache;
}
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
for (Map.Entry<String, String> entry : attributes.entrySet()) {
xml.attribute(entry.getKey(), entry.getValue());
}
xml.rightAngleBracket();
xml.optEscape(text);
if (elements != null) {
for (Map.Entry<String, StandardExtensionElement> entry : elements.entrySet()) {
xml.append(entry.getValue().toXML(getNamespace()));
}
}
xml.closeElement(this);
xmlCache = xml;
return xml;
}
use of org.jivesoftware.smack.util.XmlStringBuilder in project Smack by igniterealtime.
the class StreamError method toXML.
@Override
public XmlStringBuilder toXML() {
XmlStringBuilder xml = new XmlStringBuilder();
xml.openElement(ELEMENT);
xml.halfOpenElement(condition.toString()).xmlnsAttribute(NAMESPACE).closeEmptyElement();
addDescriptiveTextsAndExtensions(xml);
xml.closeElement(ELEMENT);
return xml;
}
use of org.jivesoftware.smack.util.XmlStringBuilder in project Smack by igniterealtime.
the class StreamOpen method toXML.
@Override
public XmlStringBuilder toXML() {
XmlStringBuilder xml = new XmlStringBuilder(this);
xml.attribute("to", to);
xml.attribute("xmlns:stream", "http://etherx.jabber.org/streams");
xml.attribute("version", VERSION);
xml.optAttribute("from", from);
xml.optAttribute("id", id);
xml.xmllangAttribute(lang);
xml.rightAngleBracket();
return xml;
}
Aggregations