org.jivesoftware.smack.util.XmlStringBuilder Java Examples
The following examples show how to use
org.jivesoftware.smack.util.XmlStringBuilder.
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: MUCLightElements.java From Smack with Apache License 2.0 | 6 votes |
@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 #2
Source File: PostEntryExtension.java From mangosta-android with Apache License 2.0 | 6 votes |
@Override public CharSequence toXML() { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.halfOpenElement("title"); xml.attribute("type", "text"); xml.rightAngleBracket(); xml.escape(title); xml.closeElement("title"); String timeStamp = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(published); String idTag = "tag:" + XMPPSession.getInstance().getXMPPConnection().getUser().getDomain() + "," + timeStamp + ":posts-" + id; xml.element("id", idTag); xml.element("published", published); xml.element("updated", updated); xml.closeElement(this); return xml; }
Example #3
Source File: OmemoBundleElement.java From Smack with Apache License 2.0 | 6 votes |
@Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this, enclosingNamespace).rightAngleBracket(); sb.halfOpenElement(SIGNED_PRE_KEY_PUB).attribute(SIGNED_PRE_KEY_ID, signedPreKeyId).rightAngleBracket() .append(signedPreKeyB64).closeElement(SIGNED_PRE_KEY_PUB); sb.openElement(SIGNED_PRE_KEY_SIG).append(signedPreKeySignatureB64).closeElement(SIGNED_PRE_KEY_SIG); sb.openElement(IDENTITY_KEY).append(identityKeyB64).closeElement(IDENTITY_KEY); sb.openElement(PRE_KEYS); for (Map.Entry<Integer, String> p : this.preKeysB64.entrySet()) { sb.halfOpenElement(PRE_KEY_PUB).attribute(PRE_KEY_ID, p.getKey()).rightAngleBracket() .append(p.getValue()).closeElement(PRE_KEY_PUB); } sb.closeElement(PRE_KEYS); sb.closeElement(this); return sb; }
Example #4
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 #5
Source File: StreamOpen.java From Smack with Apache License 2.0 | 6 votes |
@Override public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(getElementName()); String namespace = CLIENT_NAMESPACE; // We always want to state 'xmlns' for stream open tags. if (enclosingXmlEnvironment != null) { namespace = enclosingXmlEnvironment.getEffectiveNamespaceOrUse(CLIENT_NAMESPACE); } xml.attribute("xmlns", namespace); 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; }
Example #6
Source File: ReferenceElement.java From Smack with Apache License 2.0 | 6 votes |
@Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this) .optIntAttribute(ATTR_BEGIN, begin != null ? begin : -1) .optIntAttribute(ATTR_END, end != null ? end : -1) .attribute(ATTR_TYPE, type.toString()) .optAttribute(ATTR_ANCHOR, anchor) .optAttribute(ATTR_URI, uri != null ? uri.toString() : null); if (child == null) { return xml.closeEmptyElement(); } else { return xml.rightAngleBracket() .append(child.toXML()) .closeElement(this); } }
Example #7
Source File: PubkeyElement.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) .rightAngleBracket() .append(b64Data) .closeElement(this); return xml; }
Example #8
Source File: FasteningElement.java From Smack with Apache License 2.0 | 5 votes |
private void addPayloads(XmlStringBuilder xml) { for (ExternalElement external : externalPayloads) { xml.append(external); } for (ExtensionElement wrapped : wrappedPayloads) { xml.append(wrapped); } }
Example #9
Source File: NodeExtension.java From Smack with Apache License 2.0 | 5 votes |
@Override public final XmlStringBuilder toXML(XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.optAttribute("node", node); addXml(xml); return xml; }
Example #10
Source File: JingleS5BTransportInfo.java From Smack with Apache License 2.0 | 5 votes |
@Override public final XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment); xml.attribute(ATTR_CID, getCandidateId()); xml.closeEmptyElement(); return xml; }
Example #11
Source File: OpenPgpContentElement.java From Smack with Apache License 2.0 | 5 votes |
protected void addCommonXml(XmlStringBuilder xml) { for (Jid toJid : to != null ? to : Collections.<Jid>emptySet()) { xml.halfOpenElement(ELEM_TO).attribute(ATTR_JID, toJid).closeEmptyElement(); } ensureTimestampStringSet(); xml.halfOpenElement(ELEM_TIME).attribute(ATTR_STAMP, timestampString).closeEmptyElement(); xml.openElement(ELEM_PAYLOAD); for (ExtensionElement element : payload.values()) { xml.append(element.toXML(getNamespace())); } xml.closeElement(ELEM_PAYLOAD); }
Example #12
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 #13
Source File: PubkeyElement.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) .optAttribute(ATTR_DATE, date) .rightAngleBracket() .append(getDataElement()) .closeElement(this); return xml; }
Example #14
Source File: DataLayout.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); buf.attribute("var", getVar()); buf.closeEmptyElement(); return buf; }
Example #15
Source File: MUCItem.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.optAttribute("affiliation", getAffiliation()); xml.optAttribute("jid", getJid()); xml.optAttribute("nick", getNick()); xml.optAttribute("role", getRole()); xml.rightAngleBracket(); xml.optElement("reason", getReason()); if (getActor() != null) { xml.halfOpenElement("actor").attribute("jid", getActor()).closeEmptyElement(); } xml.closeElement(Stanza.ITEM); return xml; }
Example #16
Source File: Affiliation.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.optAttribute("node", node); xml.optAttribute("jid", jid); xml.optAttribute("affiliation", affiliation); xml.closeEmptyElement(); return xml; }
Example #17
Source File: Compress.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.rightAngleBracket(); xml.element("method", method); xml.closeElement(this); return xml; }
Example #18
Source File: Friend.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("jid", friend); xml.closeEmptyElement(); return xml; }
Example #19
Source File: JingleContent.java From Smack with Apache License 2.0 | 5 votes |
@Override public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingXmlEnvironment); xml.attribute(CREATOR_ATTRIBUTE_NAME, creator); xml.optAttribute(DISPOSITION_ATTRIBUTE_NAME, disposition); xml.attribute(NAME_ATTRIBUTE_NAME, name); xml.optAttribute(SENDERS_ATTRIBUTE_NAME, senders); xml.rightAngleBracket(); xml.optAppend(description); xml.optElement(transport); xml.closeElement(this); return xml; }
Example #20
Source File: Message.java From Smack with Apache License 2.0 | 5 votes |
@Override public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingXmlEnvironment); xml.rightAngleBracket(); xml.escape(message); xml.closeElement(getElementName()); return xml; }
Example #21
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 #22
Source File: DataForm.java From Smack with Apache License 2.0 | 5 votes |
@Override public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment); xml.rightAngleBracket(); xml.append(getFields()); xml.closeElement(this); return xml; }
Example #23
Source File: JingleS5BTransportInfo.java From Smack with Apache License 2.0 | 5 votes |
@Override public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.closeEmptyElement(); return xml; }
Example #24
Source File: MediaElement.java From Smack with Apache License 2.0 | 5 votes |
@Override public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment); xml.attribute("type", type) .rightAngleBracket(); xml.escape(uri.toString()); xml.closeElement(this); return xml; }
Example #25
Source File: DataLayout.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); buf.optAttribute("label", getLabel()); buf.rightAngleBracket(); buf.append(getSectionLayout()); buf.closeElement(ELEMENT); return buf; }
Example #26
Source File: OptionsExtension.java From Smack with Apache License 2.0 | 5 votes |
@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 #27
Source File: AbstractHttpOverXmpp.java From Smack with Apache License 2.0 | 5 votes |
/** * Returns string containing xml representation of this object. * * @return xml representation of this object */ @Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.rightAngleBracket(); xml.append(child); xml.closeElement(this); return xml; }
Example #28
Source File: IdleElement.java From Smack with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return new XmlStringBuilder(this) .attribute(ATTR_SINCE, since) .closeEmptyElement(); }
Example #29
Source File: ValidateElement.java From Smack with Apache License 2.0 | 5 votes |
@Override protected void appendXML(XmlStringBuilder buf) { buf.halfOpenElement(METHOD); buf.optAttribute("min", getMin()); buf.optAttribute("max", getMax()); buf.closeEmptyElement(); }
Example #30
Source File: MoodElement.java From Smack with Apache License 2.0 | 5 votes |
@Override public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment); if (concretisation == null) { return xml.closeEmptyElement(); } xml.rightAngleBracket() .append(concretisation) .closeElement(this); return xml; }