Search in sources :

Example 6 with XmlStringBuilder

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;
}
Also used : XmlStringBuilder(org.jivesoftware.smack.util.XmlStringBuilder)

Example 7 with XmlStringBuilder

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;
}
Also used : XmlStringBuilder(org.jivesoftware.smack.util.XmlStringBuilder)

Example 8 with XmlStringBuilder

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;
}
Also used : XmlStringBuilder(org.jivesoftware.smack.util.XmlStringBuilder) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) MultiMap(org.jivesoftware.smack.util.MultiMap)

Example 9 with XmlStringBuilder

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;
}
Also used : XmlStringBuilder(org.jivesoftware.smack.util.XmlStringBuilder)

Example 10 with XmlStringBuilder

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;
}
Also used : XmlStringBuilder(org.jivesoftware.smack.util.XmlStringBuilder)

Aggregations

XmlStringBuilder (org.jivesoftware.smack.util.XmlStringBuilder)59 IQChildElementXmlStringBuilder (org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Element (org.jivesoftware.smack.packet.Element)1 ExtensionElement (org.jivesoftware.smack.packet.ExtensionElement)1 MultiMap (org.jivesoftware.smack.util.MultiMap)1 FormField (org.jivesoftware.smackx.xdata.FormField)1