Java Code Examples for org.jivesoftware.smack.util.XmlStringBuilder#rightAngleBracket()

The following examples show how to use org.jivesoftware.smack.util.XmlStringBuilder#rightAngleBracket() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RosterPacket.java    From Smack with Apache License 2.0 6 votes vote down vote up
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
    xml.attribute("jid", jid);
    xml.optAttribute("name", name);
    xml.optAttribute("subscription", itemType);
    if (subscriptionPending) {
        xml.append(" ask='subscribe'");
    }
    xml.optBooleanAttribute("approved", approved);
    xml.rightAngleBracket();

    for (String groupName : groupNames) {
        xml.openElement(GROUP).escape(groupName).closeElement(GROUP);
    }
    xml.closeElement(this);
    return xml;
}
 
Example 2
Source File: MUCLightElements.java    From Smack with Apache License 2.0 6 votes vote down vote up
@Override
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder xml = new XmlStringBuilder();

    String tag = isRoom ? "room" : "user";
    xml.halfOpenElement(tag);

    String action = allow ? "allow" : "deny";
    xml.attribute("action", action);
    xml.rightAngleBracket();

    xml.escape(jid);

    xml.closeElement(tag);
    return xml;
}
 
Example 3
Source File: JingleContentTransport.java    From Smack with Apache License 2.0 6 votes vote down vote up
@Override
public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) {
    XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment);
    addExtraAttributes(xml);

    if (candidates.isEmpty() && info == null) {
        xml.closeEmptyElement();

    } else {

        xml.rightAngleBracket();
        xml.append(candidates);
        xml.optElement(info);
        xml.closeElement(this);
    }

    return xml;
}
 
Example 4
Source File: DataLayout.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder buf = new XmlStringBuilder(this, enclosingNamespace);
    buf.rightAngleBracket();
    buf.escape(getText());
    buf.closeElement(this);
    return buf;
}
 
Example 5
Source File: PublishCommentExtension.java    From mangosta-android with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence toXML() {
    XmlStringBuilder xml = new XmlStringBuilder(this);
    xml.attribute("node", NODE + "/" + blogPostId);
    xml.rightAngleBracket();

    xml.halfOpenElement("item");
    xml.attribute("id", id);
    xml.rightAngleBracket();

    xml.halfOpenElement("entry");
    xml.xmlnsAttribute("http://www.w3.org/2005/Atom");
    xml.rightAngleBracket();

    xml.openElement("author");
    xml.element("name", authorName);
    xml.element("uri", "xmpp:" + authorJid);
    xml.closeElement("author");

    xml.halfOpenElement("title");
    xml.attribute("type", "text");
    xml.rightAngleBracket();
    xml.escape(content);
    xml.closeElement("title");

    xml.element("published", published);

    xml.closeElement("entry");
    xml.closeElement("item");
    xml.closeElement(this);
    return xml;
}
 
Example 6
Source File: MultipleAddresses.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder buf = new XmlStringBuilder(this);
    buf.rightAngleBracket();
    // Loop through all the addresses and append them to the string buffer
    for (Address address : addresses) {
        buf.append(address.toXML());
    }
    buf.closeElement(this);
    return buf;
}
 
Example 7
Source File: OptionsExtension.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
protected void addXml(XmlStringBuilder xml) {
    xml.rightAngleBracket();

    xml.halfOpenElement(getElementName());
    xml.attribute("jid", jid);
    xml.optAttribute("node", getNode());
    xml.optAttribute("subid", id);

    xml.closeEmptyElement();
    xml.closeElement(this);
}
 
Example 8
Source File: PushNotificationsElements.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder xml = new XmlStringBuilder(this);

    xml.attribute("node", node);
    xml.rightAngleBracket();

    xml.halfOpenElement("affiliation");
    xml.attribute("jid", userJid);
    xml.attribute("affiliation", "none");
    xml.closeEmptyElement();

    xml.closeElement(this);
    return xml;
}
 
Example 9
Source File: FormField.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) {
    XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment);
    xml.rightAngleBracket();
    xml.escape(description);
    xml.closeElement(this);
    return xml;
}
 
Example 10
Source File: Session.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder xml = new XmlStringBuilder(this);
    if (optional) {
        xml.rightAngleBracket();
        xml.emptyElement(OPTIONAL_ELEMENT);
        xml.closeElement(this);
    } else {
        xml.closeEmptyElement();
    }
    return xml;
}
 
Example 11
Source File: Message.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
    xml.rightAngleBracket();
    xml.escape(subject);
    xml.closeElement(getElementName());
    return xml;
}
 
Example 12
Source File: DataLayout.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder buf = new XmlStringBuilder(this);
    buf.optAttribute("label", getLabel());
    buf.rightAngleBracket();

    buf.append(getPageLayout());

    buf.closeElement(this);

    return buf;
}
 
Example 13
Source File: DataForm.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) {
    XmlStringBuilder buf = new XmlStringBuilder(this, xmlEnvironment);
    buf.attribute("type", getType());
    buf.rightAngleBracket();

    xmlEnvironment = buf.getXmlEnvironment();

    buf.optElement("title", getTitle());
    for (String instruction : getInstructions()) {
        buf.element("instructions", instruction);
    }
    // Append the list of fields returned from a search
    buf.optElement(getReportedData());
    // Loop through all the items returned from a search and append them to the string buffer
    buf.append(getItems());

    // Add all form fields.
    // We do not need to include the type for data forms of the type submit.
    boolean includeType = getType() != Type.submit;
    for (FormField formField : getFields()) {
        buf.append(formField.toXML(xmlEnvironment, includeType));
    }

    buf.append(getExtensionElements());
    buf.closeElement(this);
    return buf;
}
 
Example 14
Source File: IoTFieldsExtension.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder xml = new XmlStringBuilder(this);
    xml.attribute("seqnr", Integer.toString(seqNr));
    xml.attribute("done", done);
    xml.rightAngleBracket();

    xml.append(nodes);

    xml.closeElement(this);
    return xml;
}
 
Example 15
Source File: SubscriptionsExtension.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
protected void addXml(XmlStringBuilder xml) {
    if ((items == null) || (items.size() == 0)) {
        xml.closeEmptyElement();
        return;
    }
    xml.rightAngleBracket();
    xml.append(items);
    xml.closeElement(this);
}
 
Example 16
Source File: DataLayout.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder buf = new XmlStringBuilder(this, enclosingNamespace);
    buf.optAttribute("label", getLabel());
    buf.rightAngleBracket();

    buf.append(getSectionLayout());

    buf.closeElement(ELEMENT);
    return buf;
}
 
Example 17
Source File: Destroy.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder xml = new XmlStringBuilder(this);
    xml.optAttribute("jid", getJid());
    xml.rightAngleBracket();
    xml.optElement("reason", getReason());
    xml.closeElement(this);
    return xml;
}
 
Example 18
Source File: StartTls.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);

    if (required) {
        xml.rightAngleBracket();
        xml.emptyElement("required");
        xml.closeElement(this);
    } else {
        xml.closeEmptyElement();
    }

    return xml;
}
 
Example 19
Source File: Bytestream.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
    XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
    xml.rightAngleBracket();
    xml.escape(getTarget());
    xml.closeElement(this);
    return xml;
}
 
Example 20
Source File: FormField.java    From Smack with Apache License 2.0 5 votes vote down vote up
public final XmlStringBuilder toXML(XmlEnvironment enclosingNamespace, boolean includeType) {
    XmlStringBuilder buf = new XmlStringBuilder(this, enclosingNamespace);
    // Add attributes
    buf.optAttribute("label", getLabel());
    buf.optAttribute("var", getFieldName());

    if (includeType) {
        // If no 'type' is specified, the default is "text-single";
        buf.attribute("type", getType(), Type.text_single);
    }

    if (extraXmlChildElements == null) {
        // If extraXmlChildElements is null, see if they should be populated.
        populateExtraXmlChildElements();
    }

    if (formFieldChildElements.isEmpty() && extraXmlChildElements == null) {
        buf.closeEmptyElement();
    } else {
        buf.rightAngleBracket();

        buf.optAppend(extraXmlChildElements);
        buf.append(formFieldChildElements);

        buf.closeElement(this);
    }
    return buf;
}