Java Code Examples for org.jivesoftware.smack.util.XmlStringBuilder#closeEmptyElement()
The following examples show how to use
org.jivesoftware.smack.util.XmlStringBuilder#closeEmptyElement() .
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: Range.java From Smack with Apache License 2.0 | 6 votes |
@Override public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this); sb.optAttribute(ATTR_OFFSET, offset); sb.optAttribute(ATTR_LENGTH, length); if (hash != null) { sb.rightAngleBracket(); sb.append(hash); sb.closeElement(this); } else { sb.closeEmptyElement(); } return sb; }
Example 2
Source File: UserTuneElement.java From Smack with Apache License 2.0 | 6 votes |
@Override public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this); if (isEmptyUserTune()) { return xml.closeEmptyElement(); } xml.rightAngleBracket(); xml.optElement("artist", artist); xml.optElement("length", length); xml.optElement("rating", rating); xml.optElement("source", source); xml.optElement("title", title); xml.optElement("track", track); xml.optElement("uri", uri); return xml.closeElement(getElementName()); }
Example 3
Source File: StanzaError.java From Smack with Apache License 2.0 | 6 votes |
@Override public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.attribute("type", type.toString()); xml.optAttribute("by", errorGenerator); xml.rightAngleBracket(); xml.halfOpenElement(condition.toString()); xml.xmlnsAttribute(ERROR_CONDITION_AND_TEXT_NAMESPACE); if (conditionText != null) { xml.rightAngleBracket(); xml.escape(conditionText); xml.closeElement(condition.toString()); } else { xml.closeEmptyElement(); } addDescriptiveTextsAndExtensions(xml); xml.closeElement(this); return xml; }
Example 4
Source File: MoodElement.java From Smack with Apache License 2.0 | 6 votes |
@Override public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment); if (mood == null && text == null) { // Empty mood element used as STOP signal return xml.closeEmptyElement(); } xml.rightAngleBracket(); xml.optAppend(mood); if (text != null) { xml.openElement(ELEM_TEXT) .append(text) .closeElement(ELEM_TEXT); } return xml.closeElement(getElementName()); }
Example 5
Source File: StreamManagement.java From Smack with Apache License 2.0 | 5 votes |
@Override public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); maybeAddResumeAttributeTo(xml); maybeAddMaxAttributeTo(xml); xml.closeEmptyElement(); return xml; }
Example 6
Source File: MessageCorrectExtension.java From Smack with Apache License 2.0 | 5 votes |
@Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute(ID_TAG, getIdInitialMessage()); xml.closeEmptyElement(); return xml; }
Example 7
Source File: SubscriptionsExtension.java From Smack with Apache License 2.0 | 5 votes |
@Override protected void addXml(XmlStringBuilder xml) { if ((items == null) || (items.size() == 0)) { xml.closeEmptyElement(); return; } xml.rightAngleBracket(); xml.append(items); xml.closeElement(this); }
Example 8
Source File: FormField.java From Smack with Apache License 2.0 | 5 votes |
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; }
Example 9
Source File: MUCUser.java From Smack with Apache License 2.0 | 5 votes |
@Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("code", getCode()); xml.closeEmptyElement(); return xml; }
Example 10
Source File: ListElement.java From Smack with Apache License 2.0 | 5 votes |
@Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.attribute(MarkupElement.MarkupChildElement.ATTR_START, getStart()); xml.closeEmptyElement(); return xml; }
Example 11
Source File: Bytestream.java From Smack with Apache License 2.0 | 5 votes |
@Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.attribute("jid", getJID()); xml.closeEmptyElement(); return xml; }
Example 12
Source File: ValidateElement.java From Smack with Apache License 2.0 | 5 votes |
@Override public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { XmlStringBuilder buf = new XmlStringBuilder(this, enclosingXmlEnvironment); buf.optAttribute("min", getMin()); buf.optAttribute("max", getMax()); buf.closeEmptyElement(); return buf; }
Example 13
Source File: Presence.java From Smack with Apache License 2.0 | 5 votes |
@Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(this, enclosingNamespace); addCommonAttributes(buf); if (type != Type.available) { buf.attribute("type", type); } List<ExtensionElement> extensions = getExtensions(); if (status == null && priority == null && (mode == null || mode == Mode.available) && extensions.isEmpty() && getError() == null) { return buf.closeEmptyElement(); } buf.rightAngleBracket(); buf.optElement("status", status); buf.optElement("priority", priority); if (mode != null && mode != Mode.available) { buf.element("show", mode); } buf.append(extensions); // Add the error sub-packet, if there is one. appendErrorIfExists(buf); buf.closeElement(ELEMENT); return buf; }
Example 14
Source File: Item.java From Smack with Apache License 2.0 | 4 votes |
@Override protected void addXml(XmlStringBuilder xml) { xml.optAttribute("id", getId()); xml.closeEmptyElement(); }
Example 15
Source File: UnsubscribeExtension.java From Smack with Apache License 2.0 | 4 votes |
@Override protected void addXml(XmlStringBuilder xml) { xml.attribute("jid", jid); xml.optAttribute("subid", id); xml.closeEmptyElement(); }
Example 16
Source File: GetItemsRequest.java From Smack with Apache License 2.0 | 4 votes |
@Override protected void addXml(XmlStringBuilder xml) { xml.optAttribute("subid", getSubscriptionId()); xml.optIntAttribute("max_items", getMaxItems()); xml.closeEmptyElement(); }
Example 17
Source File: DataLayout.java From Smack with Apache License 2.0 | 4 votes |
@Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(this, enclosingNamespace); buf.closeEmptyElement(); return buf; }
Example 18
Source File: RosterVer.java From Smack with Apache License 2.0 | 4 votes |
@Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.closeEmptyElement(); return xml; }
Example 19
Source File: StreamManagement.java From Smack with Apache License 2.0 | 4 votes |
@Override public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.closeEmptyElement(); return xml; }
Example 20
Source File: CapsExtension.java From Smack with Apache License 2.0 | 3 votes |
/** * {@inheritDoc}. * * <pre> * <c xmlns='http://jabber.org/protocol/caps' * hash='sha-1' * node='http://code.google.com/p/exodus' * ver='QgayPKawpkPSDYmwT/WM94uAlu0='/> * </pre> * */ @Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("hash", hash).attribute("node", node).attribute("ver", ver); xml.closeEmptyElement(); return xml; }