Java Code Examples for org.jivesoftware.smack.util.XmlStringBuilder#attribute()
The following examples show how to use
org.jivesoftware.smack.util.XmlStringBuilder#attribute() .
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: 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 2
Source File: BoBExtension.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); xml.rightAngleBracket(); xml.halfOpenElement(Message.BODY); xml.xmlnsAttribute(XHTMLText.NAMESPACE); xml.rightAngleBracket(); xml.openElement(XHTMLText.P); xml.optEscape(paragraph); xml.halfOpenElement(XHTMLText.IMG); xml.optAttribute("alt", alt); xml.attribute("src", bobHash.toSrc()); xml.closeEmptyElement(); xml.closeElement(XHTMLText.P); xml.closeElement(Message.BODY); xml.closeElement(this); return xml; }
Example 3
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 4
Source File: IQ.java From Smack with Apache License 2.0 | 5 votes |
@Override public final XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { XmlStringBuilder buf = new XmlStringBuilder(this, enclosingXmlEnvironment); addCommonAttributes(buf); if (type == null) { buf.attribute("type", "get"); } else { buf.attribute("type", type.toString()); } buf.rightAngleBracket(); appendInnerXml(buf); buf.closeElement(IQ_ELEMENT); return buf; }
Example 5
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 6
Source File: Base64BinaryChunk.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("streamId", streamId); xml.attribute("nr", nr); xml.optBooleanAttribute("last", last); xml.rightAngleBracket(); xml.append(text); xml.closeElement(this); return xml; }
Example 7
Source File: IoTFieldsExtension.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("seqnr", Integer.toString(seqNr)); xml.attribute("done", done); xml.rightAngleBracket(); xml.append(nodes); xml.closeElement(this); return xml; }
Example 8
Source File: DiscoverInfo.java From Smack with Apache License 2.0 | 5 votes |
public XmlStringBuilder toXML() { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement("feature"); xml.attribute("var", variable); xml.closeEmptyElement(); return xml; }
Example 9
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 10
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 11
Source File: HashElement.java From Smack with Apache License 2.0 | 5 votes |
@Override public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this); sb.attribute(ATTR_ALGO, algorithm.toString()); sb.rightAngleBracket(); sb.append(hashB64); sb.closeElement(this); return sb; }
Example 12
Source File: GroupChatInvitation.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", getRoomAddress()); xml.closeEmptyElement(); return xml; }
Example 13
Source File: Tag.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("name", name); xml.attribute("value", value); xml.closeEmptyElement(); return xml; }
Example 14
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); xml.attribute("h", Long.toString(handledCount)); xml.closeEmptyElement(); return xml; }
Example 15
Source File: Bookmarks.java From Smack with Apache License 2.0 | 5 votes |
/** * Returns the XML representation of the PrivateData. * * @return the private data as XML. */ @Override public XmlStringBuilder toXML() { XmlStringBuilder buf = new XmlStringBuilder(); buf.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket(); for (BookmarkedURL urlStorage : getBookmarkedURLS()) { if (urlStorage.isShared()) { continue; } buf.halfOpenElement("url").attribute("name", urlStorage.getName()).attribute("url", urlStorage.getURL()); buf.condAttribute(urlStorage.isRss(), "rss", "true"); buf.closeEmptyElement(); } // Add Conference additions for (BookmarkedConference conference : getBookmarkedConferences()) { if (conference.isShared()) { continue; } buf.halfOpenElement("conference"); buf.attribute("name", conference.getName()); buf.attribute("autojoin", Boolean.toString(conference.isAutoJoin())); buf.attribute("jid", conference.getJid()); buf.rightAngleBracket(); buf.optElement("nick", conference.getNickname()); buf.optElement("password", conference.getPassword()); buf.closeElement("conference"); } buf.closeElement(ELEMENT); return buf; }
Example 16
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 17
Source File: StreamManagement.java From Smack with Apache License 2.0 | 5 votes |
protected void maybeAddResumeAttributeTo(XmlStringBuilder xml) { if (resume) { // XEP 198 never mentions the case where resume='false', it's either set to true or // not set at all. We reflect this in this code part xml.attribute("resume", "true"); } }
Example 18
Source File: CustomPresence.java From League-of-Legends-XMPP-Chat-Library with MIT License | 5 votes |
@Override public XmlStringBuilder toXML() { final XmlStringBuilder buf = new XmlStringBuilder(); buf.halfOpenElement("presence"); buf.xmlnsAttribute(getXmlns()); buf.xmllangAttribute(getLanguage()); addCommonAttributes(buf); if (invisible) { buf.attribute("type", "invisible"); } else if (getType() != Type.available) { buf.attribute("type", getType()); } buf.rightAngelBracket(); buf.optElement("status", getStatus()); if (getPriority() != Integer.MIN_VALUE) { buf.element("priority", Integer.toString(getPriority())); } if (getMode() != null && getMode() != Mode.available) { buf.element("show", getMode()); } buf.append(getExtensionsXML()); // Add the error sub-packet, if there is one. final XMPPError error = getError(); if (error != null) { buf.append(error.toXML()); } buf.closeElement("presence"); return buf; }
Example 19
Source File: SubscribeExtension.java From Smack with Apache License 2.0 | 4 votes |
@Override protected void addXml(XmlStringBuilder xml) { xml.attribute("jid", getJid()); xml.closeEmptyElement(); }
Example 20
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(); }