mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-10-31 17:25:58 +01:00
Introduce XmlEnvironment
This commit is contained in:
parent
dc780ffd6c
commit
fee3ed81ca
229 changed files with 715 additions and 526 deletions
|
@ -45,7 +45,7 @@ public class Compress implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
|
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.element("method", method);
|
xml.element("method", method);
|
||||||
|
@ -77,7 +77,7 @@ public class Compress implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
for (String method : methods) {
|
for (String method : methods) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ public final class Compressed implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class Failure implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
|
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ public abstract class AbstractDebugger extends SmackDebugger {
|
||||||
@Override
|
@Override
|
||||||
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
||||||
if (printInterpreted) {
|
if (printInterpreted) {
|
||||||
log("RCV PKT (" + connection.getConnectionCounter() + "): " + streamElement.toXML(null));
|
log("RCV PKT (" + connection.getConnectionCounter() + "): " + streamElement.toXML());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class AbstractError {
|
||||||
xml.closeElement("text");
|
xml.closeElement("text");
|
||||||
}
|
}
|
||||||
for (ExtensionElement packetExtension : extensions) {
|
for (ExtensionElement packetExtension : extensions) {
|
||||||
xml.append(packetExtension.toXML(null));
|
xml.append(packetExtension.toXML());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public abstract class AbstractTextElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.optXmlLangAttribute(lang);
|
xml.optXmlLangAttribute(lang);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
|
@ -89,7 +89,7 @@ public final class Bind extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class DefaultExtensionElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder();
|
XmlStringBuilder buf = new XmlStringBuilder();
|
||||||
buf.halfOpenElement(elementName).xmlnsAttribute(namespace).rightAngleBracket();
|
buf.halfOpenElement(elementName).xmlnsAttribute(namespace).rightAngleBracket();
|
||||||
for (String name : getNames()) {
|
for (String name : getNames()) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2014-2018 Florian Schmaus
|
* Copyright © 2014-2019 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,7 +23,7 @@ package org.jivesoftware.smack.packet;
|
||||||
*/
|
*/
|
||||||
public interface Element {
|
public interface Element {
|
||||||
|
|
||||||
// TODO: Add a toXML() non-parameter default method once Smack supports Java 8.
|
CharSequence toXML(XmlEnvironment xmlEnvironment);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the XML representation of this Element. This method takes an optional argument for the enclosing
|
* Returns the XML representation of this Element. This method takes an optional argument for the enclosing
|
||||||
|
@ -32,5 +32,12 @@ public interface Element {
|
||||||
* @param enclosingNamespace the enclosing namespace or {@code null}.
|
* @param enclosingNamespace the enclosing namespace or {@code null}.
|
||||||
* @return the stanza extension as XML.
|
* @return the stanza extension as XML.
|
||||||
*/
|
*/
|
||||||
CharSequence toXML(String enclosingNamespace);
|
default CharSequence toXML(String enclosingNamespace) {
|
||||||
|
XmlEnvironment xmlEnvironment = new XmlEnvironment(enclosingNamespace);
|
||||||
|
return toXML(xmlEnvironment);
|
||||||
|
}
|
||||||
|
|
||||||
|
default CharSequence toXML() {
|
||||||
|
return toXML(XmlEnvironment.EMPTY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,10 +126,10 @@ public abstract class IQ extends Stanza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
public final XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace);
|
XmlStringBuilder buf = new XmlStringBuilder(enclosingXmlEnvironment);
|
||||||
buf.halfOpenElement(IQ_ELEMENT);
|
buf.halfOpenElement(IQ_ELEMENT);
|
||||||
addCommonAttributes(buf, enclosingNamespace);
|
addCommonAttributes(buf, enclosingXmlEnvironment);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
buf.attribute("type", "get");
|
buf.attribute("type", "get");
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ public abstract class IQ extends Stanza {
|
||||||
buf.attribute("type", type.toString());
|
buf.attribute("type", type.toString());
|
||||||
}
|
}
|
||||||
buf.rightAngleBracket();
|
buf.rightAngleBracket();
|
||||||
buf.append(getChildElementXML(enclosingNamespace));
|
buf.append(getChildElementXML(enclosingXmlEnvironment));
|
||||||
buf.closeElement(IQ_ELEMENT);
|
buf.closeElement(IQ_ELEMENT);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -156,15 +156,15 @@ public abstract class IQ extends Stanza {
|
||||||
* Returns the sub-element XML section of the IQ packet, or the empty String if there
|
* Returns the sub-element XML section of the IQ packet, or the empty String if there
|
||||||
* isn't one.
|
* isn't one.
|
||||||
*
|
*
|
||||||
* @param enclosingNamespace the enclosing XML namespace.
|
* @param enclosingXmlEnvironment the enclosing XML namespace.
|
||||||
* @return the child element section of the IQ XML.
|
* @return the child element section of the IQ XML.
|
||||||
* @since 4.3.0
|
* @since 4.3.0
|
||||||
*/
|
*/
|
||||||
public final XmlStringBuilder getChildElementXML(String enclosingNamespace) {
|
public final XmlStringBuilder getChildElementXML(XmlEnvironment enclosingXmlEnvironment) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
if (type == Type.error) {
|
if (type == Type.error) {
|
||||||
// Add the error sub-packet, if there is one.
|
// Add the error sub-packet, if there is one.
|
||||||
appendErrorIfExists(xml, enclosingNamespace);
|
appendErrorIfExists(xml, enclosingXmlEnvironment);
|
||||||
}
|
}
|
||||||
else if (childElementName != null) {
|
else if (childElementName != null) {
|
||||||
// Add the query section if there is one.
|
// Add the query section if there is one.
|
||||||
|
@ -240,7 +240,7 @@ public abstract class IQ extends Stanza {
|
||||||
protected final void initializeAsResultFor(IQ request) {
|
protected final void initializeAsResultFor(IQ request) {
|
||||||
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML(null));
|
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
||||||
}
|
}
|
||||||
setStanzaId(request.getStanzaId());
|
setStanzaId(request.getStanzaId());
|
||||||
setFrom(request.getTo());
|
setFrom(request.getTo());
|
||||||
|
@ -289,7 +289,7 @@ public abstract class IQ extends Stanza {
|
||||||
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Builder error) {
|
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Builder error) {
|
||||||
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML(null));
|
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
||||||
}
|
}
|
||||||
final ErrorIQ result = new ErrorIQ(error);
|
final ErrorIQ result = new ErrorIQ(error);
|
||||||
result.setStanzaId(request.getStanzaId());
|
result.setStanzaId(request.getStanzaId());
|
||||||
|
@ -381,7 +381,6 @@ public abstract class IQ extends Stanza {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IQChildElementXmlStringBuilder(String element, String namespace) {
|
private IQChildElementXmlStringBuilder(String element, String namespace) {
|
||||||
super("");
|
|
||||||
prelude(element, namespace);
|
prelude(element, namespace);
|
||||||
this.element = element;
|
this.element = element;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class Mechanisms implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
for (String mechanism : mechanisms) {
|
for (String mechanism : mechanisms) {
|
||||||
|
|
|
@ -479,10 +479,10 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace);
|
XmlStringBuilder buf = new XmlStringBuilder(enclosingXmlEnvironment);
|
||||||
buf.halfOpenElement(ELEMENT);
|
buf.halfOpenElement(ELEMENT);
|
||||||
enclosingNamespace = addCommonAttributes(buf, enclosingNamespace);
|
enclosingXmlEnvironment = addCommonAttributes(buf, enclosingXmlEnvironment);
|
||||||
buf.optAttribute("type", type);
|
buf.optAttribute("type", type);
|
||||||
buf.rightAngleBracket();
|
buf.rightAngleBracket();
|
||||||
|
|
||||||
|
@ -496,16 +496,16 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
// Skip the default language
|
// Skip the default language
|
||||||
if (subject.equals(defaultSubject))
|
if (subject.equals(defaultSubject))
|
||||||
continue;
|
continue;
|
||||||
buf.append(subject.toXML(null));
|
buf.append(subject.toXML());
|
||||||
}
|
}
|
||||||
buf.optElement("thread", thread);
|
buf.optElement("thread", thread);
|
||||||
// Append the error subpacket if the message type is an error.
|
// Append the error subpacket if the message type is an error.
|
||||||
if (type == Type.error) {
|
if (type == Type.error) {
|
||||||
appendErrorIfExists(buf, enclosingNamespace);
|
appendErrorIfExists(buf, enclosingXmlEnvironment);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add extension elements, if any are defined.
|
// Add extension elements, if any are defined.
|
||||||
buf.append(getExtensions(), enclosingNamespace);
|
buf.append(getExtensions(), enclosingXmlEnvironment);
|
||||||
|
|
||||||
buf.closeElement(ELEMENT);
|
buf.closeElement(ELEMENT);
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -600,7 +600,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(getElementName()).optXmlLangAttribute(getLanguage()).rightAngleBracket();
|
xml.halfOpenElement(getElementName()).optXmlLangAttribute(getLanguage()).rightAngleBracket();
|
||||||
xml.escape(subject);
|
xml.escape(subject);
|
||||||
|
@ -708,8 +708,8 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
|
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingXmlEnvironment);
|
||||||
xml.optXmlLangAttribute(getLanguage()).rightAngleBracket();
|
xml.optXmlLangAttribute(getLanguage()).rightAngleBracket();
|
||||||
xml.escape(message);
|
xml.escape(message);
|
||||||
xml.closeElement(getElementName());
|
xml.closeElement(getElementName());
|
||||||
|
|
|
@ -272,7 +272,7 @@ public final class Presence extends Stanza implements TypedCloneable<Presence> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace);
|
XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace);
|
||||||
buf.halfOpenElement(ELEMENT);
|
buf.halfOpenElement(ELEMENT);
|
||||||
addCommonAttributes(buf, enclosingNamespace);
|
addCommonAttributes(buf, enclosingNamespace);
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class Session extends SimpleIQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
if (optional) {
|
if (optional) {
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
|
@ -132,7 +132,7 @@ public final class StandardExtensionElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
if (xmlCache != null) {
|
if (xmlCache != null) {
|
||||||
return xmlCache;
|
return xmlCache;
|
||||||
}
|
}
|
||||||
|
|
|
@ -503,25 +503,30 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
* Add to, from, id and 'xml:lang' attributes
|
* Add to, from, id and 'xml:lang' attributes
|
||||||
*
|
*
|
||||||
* @param xml the {@link XmlStringBuilder}.
|
* @param xml the {@link XmlStringBuilder}.
|
||||||
* @param enclosingNamespace the enclosing XML namespace.
|
* @param enclosingXmlEnvironment the enclosing XML namespace.
|
||||||
* @return the set namespace for this stanza.
|
* @return the XML environment for this stanza.
|
||||||
*/
|
*/
|
||||||
protected String addCommonAttributes(XmlStringBuilder xml, String enclosingNamespace) {
|
protected XmlEnvironment addCommonAttributes(XmlStringBuilder xml, XmlEnvironment enclosingXmlEnvironment) {
|
||||||
String namespace;
|
String language = getLanguage();
|
||||||
if (enclosingNamespace == null || !enclosingNamespace.equals(StreamOpen.CLIENT_NAMESPACE)
|
String namespace = StreamOpen.CLIENT_NAMESPACE;
|
||||||
|| !enclosingNamespace.equals(StreamOpen.SERVER_NAMESPACE)) {
|
if (enclosingXmlEnvironment != null) {
|
||||||
namespace = StreamOpen.CLIENT_NAMESPACE;
|
String effectiveEnclosingNamespace = enclosingXmlEnvironment.getEffectiveNamespaceOrUse(namespace);
|
||||||
} else {
|
switch (effectiveEnclosingNamespace) {
|
||||||
namespace = enclosingNamespace;
|
case StreamOpen.CLIENT_NAMESPACE:
|
||||||
|
case StreamOpen.SERVER_NAMESPACE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
namespace = effectiveEnclosingNamespace;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xml.xmlnsAttribute(namespace);
|
xml.xmlnsAttribute(namespace);
|
||||||
xml.optAttribute("to", getTo());
|
xml.optAttribute("to", getTo());
|
||||||
xml.optAttribute("from", getFrom());
|
xml.optAttribute("from", getFrom());
|
||||||
xml.optAttribute("id", getStanzaId());
|
xml.optAttribute("id", getStanzaId());
|
||||||
xml.xmllangAttribute(getLanguage());
|
xml.xmllangAttribute(language);
|
||||||
|
|
||||||
return namespace;
|
return new XmlEnvironment(namespace, language);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void logCommonAttributes(StringBuilder sb) {
|
protected void logCommonAttributes(StringBuilder sb) {
|
||||||
|
@ -541,10 +546,10 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
*
|
*
|
||||||
* @param xml the XmlStringBuilder to append the error to.
|
* @param xml the XmlStringBuilder to append the error to.
|
||||||
*/
|
*/
|
||||||
protected void appendErrorIfExists(XmlStringBuilder xml, String enclosingNamespace) {
|
protected void appendErrorIfExists(XmlStringBuilder xml, XmlEnvironment enclosingXmlEnvironment) {
|
||||||
StanzaError error = getError();
|
StanzaError error = getError();
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
xml.append(error.toXML(enclosingNamespace));
|
xml.append(error.toXML(enclosingXmlEnvironment));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2003-2007 Jive Software, 2015-2018 Florian Schmaus
|
* Copyright 2003-2007 Jive Software, 2015-2019 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -214,17 +214,8 @@ public class StanzaError extends AbstractError implements ExtensionElement {
|
||||||
return StreamOpen.CLIENT_NAMESPACE;
|
return StreamOpen.CLIENT_NAMESPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the error as XML.
|
|
||||||
*
|
|
||||||
* @return the error as XML.
|
|
||||||
*/
|
|
||||||
public XmlStringBuilder toXML() {
|
|
||||||
return toXML(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
|
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
|
||||||
xml.attribute("type", type.toString());
|
xml.attribute("type", type.toString());
|
||||||
xml.optAttribute("by", errorGenerator);
|
xml.optAttribute("by", errorGenerator);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class StartTls implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
|
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.condEmptyElement(required, "required");
|
xml.condEmptyElement(required, "required");
|
||||||
|
|
|
@ -24,7 +24,7 @@ public final class StreamClose implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return "</" + getElementName() + '>';
|
return "</" + getElementName() + '>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,11 +136,11 @@ public class StreamError extends AbstractError implements Nonza {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toXML(null).toString();
|
return toXML().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.openElement(ELEMENT);
|
xml.openElement(ELEMENT);
|
||||||
xml.halfOpenElement(condition.toString()).xmlnsAttribute(NAMESPACE).closeEmptyElement();
|
xml.halfOpenElement(condition.toString()).xmlnsAttribute(NAMESPACE).closeEmptyElement();
|
||||||
|
|
|
@ -96,14 +96,16 @@ public class StreamOpen implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(getElementName());
|
xml.halfOpenElement(getElementName());
|
||||||
|
|
||||||
|
String namespace = CLIENT_NAMESPACE;
|
||||||
// We always want to state 'xmlns' for stream open tags.
|
// We always want to state 'xmlns' for stream open tags.
|
||||||
if (enclosingNamespace == null) {
|
if (enclosingXmlEnvironment != null) {
|
||||||
enclosingNamespace = CLIENT_NAMESPACE;
|
namespace = enclosingXmlEnvironment.getEffectiveNamespaceOrUse(CLIENT_NAMESPACE);
|
||||||
}
|
}
|
||||||
xml.attribute("xmlns", enclosingNamespace);
|
xml.attribute("xmlns", namespace);
|
||||||
|
|
||||||
xml.attribute("to", to);
|
xml.attribute("to", to);
|
||||||
xml.attribute("xmlns:stream", "http://etherx.jabber.org/streams");
|
xml.attribute("xmlns:stream", "http://etherx.jabber.org/streams");
|
||||||
|
|
|
@ -37,7 +37,7 @@ public final class TlsFailure implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public final class TlsProceed implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,134 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright 2019 Florian Schmaus
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
|
public class XmlEnvironment {
|
||||||
|
|
||||||
|
public static final XmlEnvironment EMPTY = new XmlEnvironment((String) null);
|
||||||
|
|
||||||
|
private final String namespace;
|
||||||
|
private final String language;
|
||||||
|
private final XmlEnvironment next;
|
||||||
|
|
||||||
|
private transient boolean effectiveNamespaceDetermined;
|
||||||
|
private transient boolean effectiveLanguageDetermined;
|
||||||
|
private transient String effectiveNamespace;
|
||||||
|
private transient String effectiveLanguage;
|
||||||
|
|
||||||
|
public XmlEnvironment(String namespace) {
|
||||||
|
this(namespace, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmlEnvironment(String namespace, String language) {
|
||||||
|
this(namespace, language, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private XmlEnvironment(Builder builder) {
|
||||||
|
this(builder.namespace, builder.language, builder.next);
|
||||||
|
}
|
||||||
|
|
||||||
|
private XmlEnvironment(String namespace, String language, XmlEnvironment next) {
|
||||||
|
this.namespace = namespace;
|
||||||
|
this.language = language;
|
||||||
|
this.next = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNamespace() {
|
||||||
|
return namespace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEffectiveNamespace() {
|
||||||
|
if (effectiveNamespaceDetermined) {
|
||||||
|
return effectiveNamespace;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(namespace)) {
|
||||||
|
effectiveNamespace = namespace;
|
||||||
|
} else if (next != null) {
|
||||||
|
effectiveNamespace = next.getEffectiveNamespace();
|
||||||
|
}
|
||||||
|
|
||||||
|
effectiveNamespaceDetermined = true;
|
||||||
|
return effectiveNamespace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEffectiveNamespaceOrUse(String namespace) {
|
||||||
|
String effectiveNamespace = getEffectiveLanguage();
|
||||||
|
if (StringUtils.isNullOrEmpty(effectiveNamespace)) {
|
||||||
|
return namespace;
|
||||||
|
}
|
||||||
|
return effectiveNamespace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean effectiveNamespaceEquals(String namespace) {
|
||||||
|
String effectiveNamespace = getEffectiveNamespace();
|
||||||
|
if (effectiveNamespace == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return effectiveNamespace.equals(namespace);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEffectiveLanguage() {
|
||||||
|
if (effectiveLanguageDetermined) {
|
||||||
|
return effectiveLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(language)) {
|
||||||
|
effectiveLanguage = language;
|
||||||
|
} else if (next != null) {
|
||||||
|
effectiveLanguage = next.getEffectiveLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
|
effectiveLanguageDetermined = true;
|
||||||
|
return effectiveLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
private String namespace;
|
||||||
|
private String language;
|
||||||
|
private XmlEnvironment next;
|
||||||
|
|
||||||
|
public Builder withNamespace(String namespace) {
|
||||||
|
this.namespace = namespace;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder withLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder withNext(XmlEnvironment next) {
|
||||||
|
this.next = next;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmlEnvironment build() {
|
||||||
|
return new XmlEnvironment(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -44,7 +44,7 @@ public class SaslStreamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).attribute("mechanism", mechanism).rightAngleBracket();
|
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).attribute("mechanism", mechanism).rightAngleBracket();
|
||||||
xml.optAppend(authenticationText);
|
xml.optAppend(authenticationText);
|
||||||
|
@ -84,7 +84,7 @@ public class SaslStreamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder().halfOpenElement(ELEMENT).xmlnsAttribute(
|
XmlStringBuilder xml = new XmlStringBuilder().halfOpenElement(ELEMENT).xmlnsAttribute(
|
||||||
NAMESPACE).rightAngleBracket();
|
NAMESPACE).rightAngleBracket();
|
||||||
xml.optAppend(data);
|
xml.optAppend(data);
|
||||||
|
@ -120,7 +120,7 @@ public class SaslStreamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
||||||
xml.optAppend(authenticationText);
|
xml.optAppend(authenticationText);
|
||||||
|
@ -171,7 +171,7 @@ public class SaslStreamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
||||||
xml.optAppend(data);
|
xml.optAppend(data);
|
||||||
|
@ -236,7 +236,7 @@ public class SaslStreamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
||||||
xml.emptyElement(saslErrorString);
|
xml.emptyElement(saslErrorString);
|
||||||
|
@ -247,7 +247,7 @@ public class SaslStreamElements {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toXML(null).toString();
|
return toXML().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2014-2018 Florian Schmaus
|
* Copyright 2014-2019 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -26,6 +26,7 @@ import org.jivesoftware.smack.packet.Element;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
||||||
import org.jivesoftware.smack.packet.NamedElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
|
|
||||||
import org.jxmpp.util.XmppDateTime;
|
import org.jxmpp.util.XmppDateTime;
|
||||||
|
|
||||||
|
@ -34,15 +35,15 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
|
|
||||||
private final LazyStringBuilder sb;
|
private final LazyStringBuilder sb;
|
||||||
|
|
||||||
private final String enclosingNamespace;
|
private final XmlEnvironment effectiveXmlEnvironment;
|
||||||
|
|
||||||
public XmlStringBuilder() {
|
public XmlStringBuilder() {
|
||||||
this("");
|
this((XmlEnvironment) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder(String enclosingNamespace) {
|
public XmlStringBuilder(XmlEnvironment effectiveXmlEnvironment) {
|
||||||
sb = new LazyStringBuilder();
|
sb = new LazyStringBuilder();
|
||||||
this.enclosingNamespace = enclosingNamespace != null ? enclosingNamespace : "";
|
this.effectiveXmlEnvironment = effectiveXmlEnvironment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder(ExtensionElement pe) {
|
public XmlStringBuilder(ExtensionElement pe) {
|
||||||
|
@ -55,8 +56,8 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
halfOpenElement(e.getElementName());
|
halfOpenElement(e.getElementName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder(FullyQualifiedElement ee, String enclosingNamespace) {
|
public XmlStringBuilder(FullyQualifiedElement ee, XmlEnvironment enclosingXmlEnvironment) {
|
||||||
this(enclosingNamespace);
|
this(enclosingXmlEnvironment);
|
||||||
prelude(ee);
|
prelude(ee);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
|
|
||||||
public XmlStringBuilder element(Element element) {
|
public XmlStringBuilder element(Element element) {
|
||||||
assert element != null;
|
assert element != null;
|
||||||
return append(element.toXML(null));
|
return append(element.toXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder optElement(String name, String content) {
|
public XmlStringBuilder optElement(String name, String content) {
|
||||||
|
@ -152,7 +153,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
|
|
||||||
public XmlStringBuilder optElement(Element element) {
|
public XmlStringBuilder optElement(Element element) {
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
append(element.toXML(null));
|
append(element.toXML());
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -399,10 +400,12 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder xmlnsAttribute(String value) {
|
public XmlStringBuilder xmlnsAttribute(String value) {
|
||||||
if (value != null && !enclosingNamespace.equals(value)) {
|
if (value == null || (effectiveXmlEnvironment != null
|
||||||
|
&& effectiveXmlEnvironment.effectiveNamespaceEquals(value))) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
XmlNsAttribute xmlNsAttribute = new XmlNsAttribute(value);
|
XmlNsAttribute xmlNsAttribute = new XmlNsAttribute(value);
|
||||||
append(xmlNsAttribute);
|
append(xmlNsAttribute);
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +463,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
|
|
||||||
public XmlStringBuilder optAppend(Element element) {
|
public XmlStringBuilder optAppend(Element element) {
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
append(element.toXML(enclosingNamespace));
|
append(element.toXML(effectiveXmlEnvironment));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -475,9 +478,9 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
return append(elements, null);
|
return append(elements, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder append(Collection<? extends Element> elements, String enclosingNamespace) {
|
public XmlStringBuilder append(Collection<? extends Element> elements, XmlEnvironment enclosingXmlEnvironment) {
|
||||||
for (Element element : elements) {
|
for (Element element : elements) {
|
||||||
append(element.toXML(enclosingNamespace));
|
append(element.toXML(enclosingXmlEnvironment));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -592,22 +595,22 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(XmlEnvironment enclosingXmlEnvironment) {
|
||||||
StringBuilder res = new StringBuilder();
|
StringBuilder res = new StringBuilder();
|
||||||
appendXmlTo(res, enclosingNamespace);
|
appendXmlTo(res, enclosingXmlEnvironment);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void appendXmlTo(StringBuilder res, String enclosingNamespace) {
|
private void appendXmlTo(StringBuilder res, XmlEnvironment enclosingXmlEnvironment) {
|
||||||
for (CharSequence csq : sb.getAsList()) {
|
for (CharSequence csq : sb.getAsList()) {
|
||||||
if (csq instanceof XmlStringBuilder) {
|
if (csq instanceof XmlStringBuilder) {
|
||||||
((XmlStringBuilder) csq).appendXmlTo(res, enclosingNamespace);
|
((XmlStringBuilder) csq).appendXmlTo(res, enclosingXmlEnvironment);
|
||||||
}
|
}
|
||||||
else if (csq instanceof XmlNsAttribute) {
|
else if (csq instanceof XmlNsAttribute) {
|
||||||
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
|
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
|
||||||
if (!xmlNsAttribute.value.equals(enclosingNamespace)) {
|
if (!xmlNsAttribute.value.equals(enclosingXmlEnvironment.getEffectiveNamespace())) {
|
||||||
sb.append(xmlNsAttribute);
|
sb.append(xmlNsAttribute);
|
||||||
enclosingNamespace = xmlNsAttribute.value;
|
enclosingXmlEnvironment = new XmlEnvironment(xmlNsAttribute.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -182,13 +182,13 @@ public class StanzaCollectorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return "<packetId>" + getStanzaId() + "</packetId>";
|
return "<packetId>" + getStanzaId() + "</packetId>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toXML(null);
|
return toXML().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class FailureTest {
|
||||||
@Test
|
@Test
|
||||||
public void simpleFailureTest() throws SAXException, IOException {
|
public void simpleFailureTest() throws SAXException, IOException {
|
||||||
Failure failure = new Failure(Failure.CompressFailureError.processing_failed);
|
Failure failure = new Failure(Failure.CompressFailureError.processing_failed);
|
||||||
CharSequence xml = failure.toXML(null);
|
CharSequence xml = failure.toXML();
|
||||||
|
|
||||||
final String expectedXml = "<failure xmlns='http://jabber.org/protocol/compress'><processing-failed/></failure>";
|
final String expectedXml = "<failure xmlns='http://jabber.org/protocol/compress'><processing-failed/></failure>";
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class FailureTest {
|
||||||
.setCondition(Condition.bad_request)
|
.setCondition(Condition.bad_request)
|
||||||
.build();
|
.build();
|
||||||
Failure failure = new Failure(Failure.CompressFailureError.setup_failed, stanzaError);
|
Failure failure = new Failure(Failure.CompressFailureError.setup_failed, stanzaError);
|
||||||
CharSequence xml = failure.toXML(null);
|
CharSequence xml = failure.toXML();
|
||||||
|
|
||||||
final String expectedXml = "<failure xmlns='http://jabber.org/protocol/compress'>"
|
final String expectedXml = "<failure xmlns='http://jabber.org/protocol/compress'>"
|
||||||
+ "<setup-failed/>"
|
+ "<setup-failed/>"
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class IQResponseTest {
|
||||||
assertNotNull(result.getStanzaId());
|
assertNotNull(result.getStanzaId());
|
||||||
assertEquals(request.getStanzaId(), result.getStanzaId());
|
assertEquals(request.getStanzaId(), result.getStanzaId());
|
||||||
assertEquals(request.getFrom(), result.getTo());
|
assertEquals(request.getFrom(), result.getTo());
|
||||||
assertEquals(error.build().toXML(), result.getError().toXML());
|
assertEquals(error.build().toXML().toString(), result.getError().toXML().toString());
|
||||||
// TODO this test was never valid
|
// TODO this test was never valid
|
||||||
// assertEquals(CHILD_ELEMENT, result.getChildElementXML());
|
// assertEquals(CHILD_ELEMENT, result.getChildElementXML());
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright 2019 Florian Schmaus
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class XmlEnvironmentTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNamespaceScope() {
|
||||||
|
final String outerNamespace = "outerNamespace";
|
||||||
|
|
||||||
|
XmlEnvironment outer = XmlEnvironment.builder().withNamespace(outerNamespace).build();
|
||||||
|
XmlEnvironment inner = XmlEnvironment.builder().withNext(outer).build();
|
||||||
|
|
||||||
|
assertEquals(outerNamespace, inner.getEffectiveNamespace());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLanguageScope() {
|
||||||
|
final String outerLanguage = "outerLanguage";
|
||||||
|
|
||||||
|
XmlEnvironment outer = XmlEnvironment.builder().withLanguage(outerLanguage).build();
|
||||||
|
XmlEnvironment inner = XmlEnvironment.builder().withNext(outer).build();
|
||||||
|
|
||||||
|
assertEquals(outerLanguage, inner.getEffectiveLanguage());
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,7 +31,7 @@ public class StandardExtensionElementParserTest {
|
||||||
builder.addAttribute("attr1", "attr1-value");
|
builder.addAttribute("attr1", "attr1-value");
|
||||||
builder.addElement(StandardExtensionElement.builder("bar", "ns2").addAttribute("attr2", "attr2-value").build());
|
builder.addElement(StandardExtensionElement.builder("bar", "ns2").addAttribute("attr2", "attr2-value").build());
|
||||||
builder.addElement("another-element", "another-element-text");
|
builder.addElement("another-element", "another-element-text");
|
||||||
final String elementString = builder.build().toXML(null).toString();
|
final String elementString = builder.build().toXML().toString();
|
||||||
|
|
||||||
StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString));
|
StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString));
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class StandardExtensionElementParserTest {
|
||||||
|
|
||||||
assertEquals("another-element-text", parsedElement.getFirstElement("another-element").getText());
|
assertEquals("another-element-text", parsedElement.getFirstElement("another-element").getText());
|
||||||
|
|
||||||
String parsedElementString = parsedElement.toXML(null).toString();
|
String parsedElementString = parsedElement.toXML().toString();
|
||||||
assertEquals(elementString, parsedElementString);
|
assertEquals(elementString, parsedElementString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class StandardExtensionElementParserTest {
|
||||||
StandardExtensionElement.Builder builder = StandardExtensionElement.builder("foo", "ns1-value");
|
StandardExtensionElement.Builder builder = StandardExtensionElement.builder("foo", "ns1-value");
|
||||||
builder.addAttribute("xmlns:ns2", "ns2-value");
|
builder.addAttribute("xmlns:ns2", "ns2-value");
|
||||||
builder.addAttribute("ns2:bar", "bar-ns2-value");
|
builder.addAttribute("ns2:bar", "bar-ns2-value");
|
||||||
final String elementString = builder.build().toXML(null).toString();
|
final String elementString = builder.build().toXML().toString();
|
||||||
|
|
||||||
StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString));
|
StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString));
|
||||||
assertEquals("foo", parsedElement.getElementName());
|
assertEquals("foo", parsedElement.getElementName());
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().isEmpty());
|
assertTrue(message.getBodyLanguages().isEmpty());
|
||||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||||
assertNull(message.getBody(otherLanguage));
|
assertNull(message.getBody(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML(null).toString());
|
assertXMLEqual(control, message.toXML().toString());
|
||||||
|
|
||||||
// message has non-default language, body has no language
|
// message has non-default language, body has no language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -105,7 +105,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().isEmpty());
|
assertTrue(message.getBodyLanguages().isEmpty());
|
||||||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||||
assertNull(message.getBody(defaultLanguage));
|
assertNull(message.getBody(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML(null).toString());
|
assertXMLEqual(control, message.toXML().toString());
|
||||||
|
|
||||||
// message has no language, body has no language
|
// message has no language, body has no language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -124,7 +124,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().isEmpty());
|
assertTrue(message.getBodyLanguages().isEmpty());
|
||||||
assertEquals(defaultLanguage, message.getBody(null));
|
assertEquals(defaultLanguage, message.getBody(null));
|
||||||
assertNull(message.getBody(otherLanguage));
|
assertNull(message.getBody(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML(null).toString());
|
assertXMLEqual(control, message.toXML().toString());
|
||||||
|
|
||||||
// message has no language, body has default language
|
// message has no language, body has default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -145,7 +145,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||||
assertNull(message.getBody(otherLanguage));
|
assertNull(message.getBody(otherLanguage));
|
||||||
|
|
||||||
assertXMLEqual(control, message.toXML(null).toString());
|
assertXMLEqual(control, message.toXML().toString());
|
||||||
|
|
||||||
// message has no language, body has non-default language
|
// message has no language, body has non-default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -166,7 +166,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
||||||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||||
assertNull(message.getBody(defaultLanguage));
|
assertNull(message.getBody(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML(null).toString());
|
assertXMLEqual(control, message.toXML().toString());
|
||||||
|
|
||||||
// message has default language, body has non-default language
|
// message has default language, body has non-default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -188,7 +188,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
||||||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||||
assertNull(message.getBody(defaultLanguage));
|
assertNull(message.getBody(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML(null).toString());
|
assertXMLEqual(control, message.toXML().toString());
|
||||||
|
|
||||||
// message has non-default language, body has default language
|
// message has non-default language, body has default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -210,7 +210,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().contains(defaultLanguage));
|
assertTrue(message.getBodyLanguages().contains(defaultLanguage));
|
||||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||||
assertNull(message.getBody(otherLanguage));
|
assertNull(message.getBody(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML(null).toString());
|
assertXMLEqual(control, message.toXML().toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(2, message.getBodies().size());
|
assertEquals(2, message.getBodies().size());
|
||||||
assertEquals(1, message.getBodyLanguages().size());
|
assertEquals(1, message.getBodyLanguages().size());
|
||||||
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML(null).toString());
|
assertXMLEqual(control, message.toXML().toString());
|
||||||
|
|
||||||
// message has non-default language, first body no language, second body default language
|
// message has non-default language, first body no language, second body default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -419,7 +419,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(2, message.getBodies().size());
|
assertEquals(2, message.getBodies().size());
|
||||||
assertEquals(1, message.getBodyLanguages().size());
|
assertEquals(1, message.getBodyLanguages().size());
|
||||||
assertTrue(message.getBodyLanguages().contains(defaultLanguage));
|
assertTrue(message.getBodyLanguages().contains(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML(null).toString());
|
assertXMLEqual(control, message.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Re-enable once we throw an exception on duplicate body elements.
|
// TODO: Re-enable once we throw an exception on duplicate body elements.
|
||||||
|
@ -452,7 +452,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||||
assertEquals(1, message.getBodies().size());
|
assertEquals(1, message.getBodies().size());
|
||||||
assertEquals(0, message.getBodyLanguages().size());
|
assertEquals(0, message.getBodyLanguages().size());
|
||||||
assertXMLNotEqual(control, message.toXML(null).toString());
|
assertXMLNotEqual(control, message.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
|
@ -510,7 +510,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||||
assertEquals(2, message.getBodies().size());
|
assertEquals(2, message.getBodies().size());
|
||||||
assertEquals(1, message.getBodyLanguages().size());
|
assertEquals(1, message.getBodyLanguages().size());
|
||||||
assertXMLEqual(control, message.toXML(null).toString());
|
assertXMLEqual(control, message.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -692,7 +692,7 @@ public class PacketParserUtilsTest {
|
||||||
|
|
||||||
Message message = PacketParserUtils.parseMessage(TestUtils.getMessageParser(control));
|
Message message = PacketParserUtils.parseMessage(TestUtils.getMessageParser(control));
|
||||||
|
|
||||||
fail("Should throw exception. Instead got message: " + message.toXML(null).toString());
|
fail("Should throw exception. Instead got message: " + message.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -763,7 +763,7 @@ public class PacketParserUtilsTest {
|
||||||
.asString(outputProperties);
|
.asString(outputProperties);
|
||||||
|
|
||||||
Stanza message = PacketParserUtils.parseStanza(control);
|
Stanza message = PacketParserUtils.parseStanza(control);
|
||||||
XmlUnitUtils.assertSimilar(control, message.toXML(null));
|
XmlUnitUtils.assertSimilar(control, message.toXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -105,14 +105,14 @@ public class SLF4JSmackDebugger extends SmackDebugger {
|
||||||
@Override
|
@Override
|
||||||
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
||||||
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
|
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
|
||||||
logger.debug("IN {}: {}", streamElement.getClass().getName(), streamElement.toXML(null));
|
logger.debug("IN {}: {}", streamElement.getClass().getName(), streamElement.toXML());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onOutgoingStreamElement(TopLevelStreamElement streamElement) {
|
public void onOutgoingStreamElement(TopLevelStreamElement streamElement) {
|
||||||
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
|
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
|
||||||
logger.debug("OUT {}: {}", streamElement.getClass().getName(), streamElement.toXML(null));
|
logger.debug("OUT {}: {}", streamElement.getClass().getName(), streamElement.toXML());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.TopLevelStreamElement;
|
import org.jivesoftware.smack.packet.TopLevelStreamElement;
|
||||||
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.util.ObservableReader;
|
import org.jivesoftware.smack.util.ObservableReader;
|
||||||
import org.jivesoftware.smack.util.ObservableWriter;
|
import org.jivesoftware.smack.util.ObservableWriter;
|
||||||
import org.jivesoftware.smack.util.ReaderListener;
|
import org.jivesoftware.smack.util.ReaderListener;
|
||||||
|
@ -810,7 +811,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
|
|
||||||
messagesTable.addRow(
|
messagesTable.addRow(
|
||||||
new Object[] {
|
new Object[] {
|
||||||
XmlUtil.prettyFormatXml(packet.toXML(null).toString()),
|
XmlUtil.prettyFormatXml(packet.toXML().toString()),
|
||||||
dateFormatter.format(new Date()),
|
dateFormatter.format(new Date()),
|
||||||
packetReceivedIcon,
|
packetReceivedIcon,
|
||||||
packetTypeIcon,
|
packetTypeIcon,
|
||||||
|
@ -881,7 +882,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
|
|
||||||
messagesTable.addRow(
|
messagesTable.addRow(
|
||||||
new Object[] {
|
new Object[] {
|
||||||
XmlUtil.prettyFormatXml(packet.toXML(null).toString()),
|
XmlUtil.prettyFormatXml(packet.toXML().toString()),
|
||||||
dateFormatter.format(new Date()),
|
dateFormatter.format(new Date()),
|
||||||
packetSentIcon,
|
packetSentIcon,
|
||||||
packetTypeIcon,
|
packetTypeIcon,
|
||||||
|
@ -938,15 +939,14 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(XmlEnvironment enclosingNamespace) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toXML(null);
|
return toXML((XmlEnvironment) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -323,8 +323,8 @@ public class LiteDebugger extends SmackDebugger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
||||||
interpretedText1.append(streamElement.toXML(null).toString());
|
interpretedText1.append(streamElement.toXML().toString());
|
||||||
interpretedText2.append(streamElement.toXML(null).toString());
|
interpretedText2.append(streamElement.toXML().toString());
|
||||||
interpretedText1.append(NEWLINE);
|
interpretedText1.append(NEWLINE);
|
||||||
interpretedText2.append(NEWLINE);
|
interpretedText2.append(NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,10 +79,10 @@ public class CarbonExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.append(fwd.toXML(null));
|
xml.append(fwd.toXML());
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ public class CarbonExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return "<" + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return "<" + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ChatMarkersElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
return xml;
|
return xml;
|
||||||
|
@ -93,7 +93,7 @@ public class ChatMarkersElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("id", id);
|
xml.attribute("id", id);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class ClientStateIndication {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class ClientStateIndication {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ public class ClientStateIndication {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class ExplicitMessageEncryptionElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("namespace", getEncryptionNamespace());
|
xml.attribute("namespace", getEncryptionNamespace());
|
||||||
xml.optAttribute("name", getName());
|
xml.optAttribute("name", getName());
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class HashElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||||
sb.attribute(ATTR_ALGO, algorithm.toString());
|
sb.attribute(ATTR_ALGO, algorithm.toString());
|
||||||
sb.rightAngleBracket();
|
sb.rightAngleBracket();
|
||||||
|
@ -120,6 +120,6 @@ public class HashElement implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return toXML(null).toString().hashCode();
|
return toXML().toString().hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public final class NoCopyHint extends MessageProcessingHint {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public final class NoPermanentStoreHint extends MessageProcessingHint {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public final class NoStoreHint extends MessageProcessingHint {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public final class StoreHint extends MessageProcessingHint {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
* @return xml representation of this object
|
* @return xml representation of this object
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.element(child);
|
xml.element(child);
|
||||||
|
@ -215,7 +215,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.optAppend(text);
|
xml.optAppend(text);
|
||||||
|
@ -259,7 +259,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.optAppend(text);
|
xml.optAppend(text);
|
||||||
|
@ -303,7 +303,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.optAppend(text);
|
xml.optAppend(text);
|
||||||
|
@ -347,7 +347,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("streamId", streamId);
|
xml.attribute("streamId", streamId);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
@ -390,7 +390,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("sid", sid);
|
xml.attribute("sid", sid);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class Base64BinaryChunk implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("streamId", streamId);
|
xml.attribute("streamId", streamId);
|
||||||
xml.attribute("nr", nr);
|
xml.attribute("nr", nr);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class FileTooLargeError implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.element("max-file-size", String.valueOf(maxFileSize));
|
xml.element("max-file-size", String.valueOf(maxFileSize));
|
||||||
|
|
|
@ -82,7 +82,7 @@ public abstract class SetData implements NamedElement {
|
||||||
* @return the stanza extension as XML.
|
* @return the stanza extension as XML.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("name", name);
|
xml.attribute("name", name);
|
||||||
xml.attribute("value", value);
|
xml.attribute("value", value);
|
||||||
|
|
|
@ -52,7 +52,7 @@ public abstract class IoTDataField implements NamedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("name", name).attribute("value", getValueString());
|
xml.attribute("name", name).attribute("value", getValueString());
|
||||||
// TODO handle 'unit' attribute as special case if <numeric/> is implemented.
|
// TODO handle 'unit' attribute as special case if <numeric/> is implemented.
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class IoTFieldsExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("seqnr", Integer.toString(seqNr));
|
xml.attribute("seqnr", Integer.toString(seqNr));
|
||||||
xml.attribute("done", done);
|
xml.attribute("done", done);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class NodeElement implements NamedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
nodeInfo.appendTo(xml);
|
nodeInfo.appendTo(xml);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class TimestampElement implements NamedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("value", date);
|
xml.attribute("value", date);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class Tag implements NamedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("name", name);
|
xml.attribute("name", name);
|
||||||
xml.attribute("value", value);
|
xml.attribute("value", value);
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class Friend implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("jid", friend);
|
xml.attribute("jid", friend);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class Unfriend implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("jid", jid);
|
xml.attribute("jid", jid);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class Checksum implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||||
sb.optAttribute(ATTR_CREATOR, creator);
|
sb.optAttribute(ATTR_CREATOR, creator);
|
||||||
sb.optAttribute(ATTR_NAME, name);
|
sb.optAttribute(ATTR_NAME, name);
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class JingleFileTransferChild extends JingleContentDescriptionChildElemen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||||
sb.rightAngleBracket();
|
sb.rightAngleBracket();
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class Range implements NamedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||||
|
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
|
@ -133,6 +133,6 @@ public class Range implements NamedElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return toXML(null).toString().hashCode();
|
return toXML().toString().hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public abstract class AbstractJsonPacketExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.append(json);
|
xml.append(json);
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class MamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.xmlnsAttribute(NAMESPACE);
|
xml.xmlnsAttribute(NAMESPACE);
|
||||||
|
@ -167,7 +167,7 @@ public class MamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.openElement("always");
|
xml.openElement("always");
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ public class MamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.openElement("never");
|
xml.openElement("never");
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class BlockQuoteElement implements MarkupElement.BlockLevelMarkupElement
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.attribute(ATTR_START, getStart());
|
xml.attribute(ATTR_START, getStart());
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class CodeBlockElement implements MarkupElement.BlockLevelMarkupElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.attribute(ATTR_START, getStart());
|
xml.attribute(ATTR_START, getStart());
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class ListElement implements MarkupElement.MarkupChildElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.attribute(ATTR_START, getStart());
|
xml.attribute(ATTR_START, getStart());
|
||||||
|
@ -76,7 +76,7 @@ public class ListElement implements MarkupElement.MarkupChildElement {
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
for (ListEntryElement li : getEntries()) {
|
for (ListEntryElement li : getEntries()) {
|
||||||
xml.append(li.toXML(null));
|
xml.append(li.toXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
|
@ -110,7 +110,7 @@ public class ListElement implements MarkupElement.MarkupChildElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.attribute(ATTR_START, getStart());
|
xml.attribute(ATTR_START, getStart());
|
||||||
|
|
|
@ -68,11 +68,11 @@ public class MarkupElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket();
|
XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket();
|
||||||
|
|
||||||
for (MarkupChildElement child : getChildElements()) {
|
for (MarkupChildElement child : getChildElements()) {
|
||||||
xml.append(child.toXML(null));
|
xml.append(child.toXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class SpanElement implements MarkupElement.MarkupChildElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.attribute(ATTR_START, getStart());
|
xml.attribute(ATTR_START, getStart());
|
||||||
|
|
|
@ -94,7 +94,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.openElement("configuration");
|
xml.openElement("configuration");
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.openElement("occupants");
|
xml.openElement("occupants");
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement("user");
|
xml.halfOpenElement("user");
|
||||||
xml.attribute("affiliation", affiliation);
|
xml.attribute("affiliation", affiliation);
|
||||||
|
@ -373,7 +373,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
|
|
||||||
String tag = isRoom ? "room" : "user";
|
String tag = isRoom ? "room" : "user";
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class PushNotificationsElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
|
|
||||||
xml.attribute("node", node);
|
xml.attribute("node", node);
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class ReferenceElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this)
|
XmlStringBuilder xml = new XmlStringBuilder(this)
|
||||||
.optIntAttribute(ATTR_BEGIN, begin != null ? begin : -1)
|
.optIntAttribute(ATTR_BEGIN, begin != null ? begin : -1)
|
||||||
.optIntAttribute(ATTR_END, end != null ? end : -1)
|
.optIntAttribute(ATTR_END, end != null ? end : -1)
|
||||||
|
@ -186,7 +186,7 @@ public class ReferenceElement implements ExtensionElement {
|
||||||
return xml.closeEmptyElement();
|
return xml.closeEmptyElement();
|
||||||
} else {
|
} else {
|
||||||
return xml.rightAngleBracket()
|
return xml.rightAngleBracket()
|
||||||
.append(child.toXML(null))
|
.append(child.toXML())
|
||||||
.closeElement(this);
|
.closeElement(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class OriginIdElement extends StableAndUniqueIdElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return new XmlStringBuilder(this)
|
return new XmlStringBuilder(this)
|
||||||
.attribute(ATTR_ID, getId())
|
.attribute(ATTR_ID, getId())
|
||||||
.closeEmptyElement();
|
.closeEmptyElement();
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class StanzaIdElement extends StableAndUniqueIdElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return new XmlStringBuilder(this)
|
return new XmlStringBuilder(this)
|
||||||
.attribute(ATTR_ID, getId())
|
.attribute(ATTR_ID, getId())
|
||||||
.attribute(ATTR_BY, getBy())
|
.attribute(ATTR_BY, getBy())
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class SpoilerElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.optXmlLangAttribute(getLanguage());
|
xml.optXmlLangAttribute(getLanguage());
|
||||||
if (getHint() == null) {
|
if (getHint() == null) {
|
||||||
|
|
|
@ -42,18 +42,18 @@ public class MarkableExtensionTest {
|
||||||
message.setStanzaId("message-1");
|
message.setStanzaId("message-1");
|
||||||
message.setBody("My lord, dispatch; read o'er these articles.");
|
message.setBody("My lord, dispatch; read o'er these articles.");
|
||||||
message.addExtension(ChatMarkersElements.MarkableExtension.INSTANCE);
|
message.addExtension(ChatMarkersElements.MarkableExtension.INSTANCE);
|
||||||
Assert.assertEquals(markableMessageStanza, message.toXML(null).toString());
|
Assert.assertEquals(markableMessageStanza, message.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkMarkableProvider() throws Exception {
|
public void checkMarkableProvider() throws Exception {
|
||||||
XmlPullParser parser = PacketParserUtils.getParserFor(markableExtension);
|
XmlPullParser parser = PacketParserUtils.getParserFor(markableExtension);
|
||||||
MarkableExtension markableExtension1 = new MarkableProvider().parse(parser);
|
MarkableExtension markableExtension1 = new MarkableProvider().parse(parser);
|
||||||
Assert.assertEquals(markableExtension, markableExtension1.toXML(null).toString());
|
Assert.assertEquals(markableExtension, markableExtension1.toXML().toString());
|
||||||
|
|
||||||
Message message = PacketParserUtils.parseStanza(markableMessageStanza);
|
Message message = PacketParserUtils.parseStanza(markableMessageStanza);
|
||||||
MarkableExtension markableExtension2 = MarkableExtension.from(message);
|
MarkableExtension markableExtension2 = MarkableExtension.from(message);
|
||||||
Assert.assertEquals(markableExtension, markableExtension2.toXML(null).toString());
|
Assert.assertEquals(markableExtension, markableExtension2.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,10 +41,10 @@ public class HashElementTest extends SmackTestSuite {
|
||||||
String message = "Hello World!";
|
String message = "Hello World!";
|
||||||
HashElement element = HashManager.calculateHashElement(SHA_256, StringUtils.toUtf8Bytes(message));
|
HashElement element = HashManager.calculateHashElement(SHA_256, StringUtils.toUtf8Bytes(message));
|
||||||
String expected = "<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=</hash>";
|
String expected = "<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=</hash>";
|
||||||
assertEquals(expected, element.toXML(null).toString());
|
assertEquals(expected, element.toXML().toString());
|
||||||
|
|
||||||
HashElement parsed = new HashElementProvider().parse(TestUtils.getParser(expected));
|
HashElement parsed = new HashElementProvider().parse(TestUtils.getParser(expected));
|
||||||
assertEquals(expected, parsed.toXML(null).toString());
|
assertEquals(expected, parsed.toXML().toString());
|
||||||
assertEquals(SHA_256, parsed.getAlgorithm());
|
assertEquals(SHA_256, parsed.getAlgorithm());
|
||||||
assertEquals("f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=", parsed.getHashB64());
|
assertEquals("f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=", parsed.getHashB64());
|
||||||
assertArrayEquals(HashManager.sha_256(message), parsed.getHash());
|
assertArrayEquals(HashManager.sha_256(message), parsed.getHash());
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class FileTooLargeErrorCreateTest {
|
||||||
FileTooLargeError fileTooLargeError = new FileTooLargeError(20000);
|
FileTooLargeError fileTooLargeError = new FileTooLargeError(20000);
|
||||||
|
|
||||||
Assert.assertEquals(20000, fileTooLargeError.getMaxFileSize());
|
Assert.assertEquals(20000, fileTooLargeError.getMaxFileSize());
|
||||||
Assert.assertEquals(fileTooLargeErrorExtensionExample, fileTooLargeError.toXML(null).toString());
|
Assert.assertEquals(fileTooLargeErrorExtensionExample, fileTooLargeError.toXML().toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class FiltersTest extends MamTest {
|
||||||
List<String> values = new ArrayList<>();
|
List<String> values = new ArrayList<>();
|
||||||
values.add(XmppDateTime.formatXEP0082Date(date));
|
values.add(XmppDateTime.formatXEP0082Date(date));
|
||||||
|
|
||||||
assertEquals(getMamXMemberWith(fields, values), dataForm.toXML(null).toString());
|
assertEquals(getMamXMemberWith(fields, values), dataForm.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -73,7 +73,7 @@ public class FiltersTest extends MamTest {
|
||||||
List<String> values = new ArrayList<>();
|
List<String> values = new ArrayList<>();
|
||||||
values.add(XmppDateTime.formatXEP0082Date(date));
|
values.add(XmppDateTime.formatXEP0082Date(date));
|
||||||
|
|
||||||
assertEquals(getMamXMemberWith(fields, values), dataForm.toXML(null).toString());
|
assertEquals(getMamXMemberWith(fields, values), dataForm.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -88,7 +88,7 @@ public class FiltersTest extends MamTest {
|
||||||
List<CharSequence> values = new ArrayList<>();
|
List<CharSequence> values = new ArrayList<>();
|
||||||
values.add(jid);
|
values.add(jid);
|
||||||
|
|
||||||
assertEquals(getMamXMemberWith(fields, values), dataForm.toXML(null).toString());
|
assertEquals(getMamXMemberWith(fields, values), dataForm.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class RetrieveFormFieldsTest extends MamTest {
|
||||||
.build();
|
.build();
|
||||||
DataForm dataForm = mamQueryArgs.getDataForm();
|
DataForm dataForm = mamQueryArgs.getDataForm();
|
||||||
|
|
||||||
String dataFormResult = dataForm.toXML(null).toString();
|
String dataFormResult = dataForm.toXML().toString();
|
||||||
|
|
||||||
assertXmlSimilar(additionalFieldsStanza, dataFormResult);
|
assertXmlSimilar(additionalFieldsStanza, dataFormResult);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
"</markup>";
|
"</markup>";
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setEmphasis(9, 15);
|
m.setEmphasis(9, 15);
|
||||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
assertXMLEqual(xml, m.build().toXML().toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -69,7 +69,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
"</markup>";
|
"</markup>";
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setCode(9, 15);
|
m.setCode(9, 15);
|
||||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
assertXMLEqual(xml, m.build().toXML().toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -93,7 +93,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
"</markup>";
|
"</markup>";
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setDeleted(9, 15);
|
m.setDeleted(9, 15);
|
||||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
assertXMLEqual(xml, m.build().toXML().toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -127,7 +127,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
"</markup>";
|
"</markup>";
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setCodeBlock(23, 48);
|
m.setCodeBlock(23, 48);
|
||||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
assertXMLEqual(xml, m.build().toXML().toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -157,7 +157,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
.addEntry(61, 69)
|
.addEntry(61, 69)
|
||||||
.addEntry(69, 89)
|
.addEntry(69, 89)
|
||||||
.endList();
|
.endList();
|
||||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
assertXMLEqual(xml, m.build().toXML().toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -186,7 +186,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
"</markup>";
|
"</markup>";
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setBlockQuote(9 ,32);
|
m.setBlockQuote(9 ,32);
|
||||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
assertXMLEqual(xml, m.build().toXML().toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -208,7 +208,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setBlockQuote(0, 57);
|
m.setBlockQuote(0, 57);
|
||||||
m.setBlockQuote(11, 34);
|
m.setBlockQuote(11, 34);
|
||||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
assertXMLEqual(xml, m.build().toXML().toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class MUCLightConfigurationsChangeExtensionTest {
|
||||||
Assert.assertEquals("To be or not to be?", configurationsChangeExtension.getSubject());
|
Assert.assertEquals("To be or not to be?", configurationsChangeExtension.getSubject());
|
||||||
Assert.assertNull(configurationsChangeExtension.getRoomName());
|
Assert.assertNull(configurationsChangeExtension.getRoomName());
|
||||||
Assert.assertNull(configurationsChangeExtension.getCustomConfigs());
|
Assert.assertNull(configurationsChangeExtension.getCustomConfigs());
|
||||||
Assert.assertEquals(messageWithSubjectChangeExample, configurationsMessage.toXML(null).toString());
|
Assert.assertEquals(messageWithSubjectChangeExample, configurationsMessage.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -65,7 +65,7 @@ public class MUCLightConfigurationsChangeExtensionTest {
|
||||||
Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName());
|
Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName());
|
||||||
Assert.assertNull(configurationsChangeExtension.getSubject());
|
Assert.assertNull(configurationsChangeExtension.getSubject());
|
||||||
Assert.assertNull(configurationsChangeExtension.getCustomConfigs());
|
Assert.assertNull(configurationsChangeExtension.getCustomConfigs());
|
||||||
Assert.assertEquals(messageWithRoomNameChangeExample, configurationsMessage.toXML(null).toString());
|
Assert.assertEquals(messageWithRoomNameChangeExample, configurationsMessage.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -79,7 +79,7 @@ public class MUCLightConfigurationsChangeExtensionTest {
|
||||||
Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName());
|
Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName());
|
||||||
Assert.assertNull(configurationsChangeExtension.getSubject());
|
Assert.assertNull(configurationsChangeExtension.getSubject());
|
||||||
Assert.assertEquals("blue", configurationsChangeExtension.getCustomConfigs().get("color"));
|
Assert.assertEquals("blue", configurationsChangeExtension.getCustomConfigs().get("color"));
|
||||||
Assert.assertEquals(messageWithConfigsChangeExample, configurationsMessage.toXML(null).toString());
|
Assert.assertEquals(messageWithConfigsChangeExample, configurationsMessage.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class ReferenceTest extends SmackTestSuite {
|
||||||
"uri='xmpp:juliet@capulet.lit' />";
|
"uri='xmpp:juliet@capulet.lit' />";
|
||||||
URI uri = new URI("xmpp:juliet@capulet.lit");
|
URI uri = new URI("xmpp:juliet@capulet.lit");
|
||||||
ReferenceElement element = new ReferenceElement(72, 78, ReferenceElement.Type.mention, null, uri);
|
ReferenceElement element = new ReferenceElement(72, 78, ReferenceElement.Type.mention, null, uri);
|
||||||
assertXMLEqual(xml, element.toXML(null).toString());
|
assertXMLEqual(xml, element.toXML().toString());
|
||||||
assertEquals(72, (int) element.getBegin());
|
assertEquals(72, (int) element.getBegin());
|
||||||
assertEquals(78, (int) element.getEnd());
|
assertEquals(78, (int) element.getEnd());
|
||||||
assertEquals(ReferenceElement.Type.mention, element.getType());
|
assertEquals(ReferenceElement.Type.mention, element.getType());
|
||||||
|
@ -49,7 +49,7 @@ public class ReferenceTest extends SmackTestSuite {
|
||||||
assertEquals(uri, element.getUri());
|
assertEquals(uri, element.getUri());
|
||||||
|
|
||||||
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
|
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
|
||||||
assertXMLEqual(xml, parsed.toXML(null).toString());
|
assertXMLEqual(xml, parsed.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,7 +64,7 @@ public class ReferenceTest extends SmackTestSuite {
|
||||||
"uri='xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be' />";
|
"uri='xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be' />";
|
||||||
URI uri = new URI("xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be");
|
URI uri = new URI("xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be");
|
||||||
ReferenceElement element = new ReferenceElement(null, null, ReferenceElement.Type.data, null, uri);
|
ReferenceElement element = new ReferenceElement(null, null, ReferenceElement.Type.data, null, uri);
|
||||||
assertXMLEqual(xml, element.toXML(null).toString());
|
assertXMLEqual(xml, element.toXML().toString());
|
||||||
|
|
||||||
assertNull(element.getBegin());
|
assertNull(element.getBegin());
|
||||||
assertNull(element.getEnd());
|
assertNull(element.getEnd());
|
||||||
|
@ -73,7 +73,7 @@ public class ReferenceTest extends SmackTestSuite {
|
||||||
assertEquals(uri, element.getUri());
|
assertEquals(uri, element.getUri());
|
||||||
|
|
||||||
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
|
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
|
||||||
assertXMLEqual(xml, parsed.toXML(null).toString());
|
assertXMLEqual(xml, parsed.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class StableUniqueStanzaIdTest extends SmackTestSuite {
|
||||||
StanzaIdElement element = new StanzaIdElement("de305d54-75b4-431b-adb2-eb6b9e546013", "alice@wonderland.lit");
|
StanzaIdElement element = new StanzaIdElement("de305d54-75b4-431b-adb2-eb6b9e546013", "alice@wonderland.lit");
|
||||||
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
|
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
|
||||||
assertEquals("alice@wonderland.lit", element.getBy());
|
assertEquals("alice@wonderland.lit", element.getBy());
|
||||||
assertXMLEqual(xml, element.toXML(null).toString());
|
assertXMLEqual(xml, element.toXML().toString());
|
||||||
|
|
||||||
StanzaIdElement parsed = StanzaIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml));
|
StanzaIdElement parsed = StanzaIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml));
|
||||||
assertEquals(element.getId(), parsed.getId());
|
assertEquals(element.getId(), parsed.getId());
|
||||||
|
@ -52,7 +52,7 @@ public class StableUniqueStanzaIdTest extends SmackTestSuite {
|
||||||
String xml = "<origin-id xmlns='urn:xmpp:sid:0' id='de305d54-75b4-431b-adb2-eb6b9e546013' />";
|
String xml = "<origin-id xmlns='urn:xmpp:sid:0' id='de305d54-75b4-431b-adb2-eb6b9e546013' />";
|
||||||
OriginIdElement element = new OriginIdElement("de305d54-75b4-431b-adb2-eb6b9e546013");
|
OriginIdElement element = new OriginIdElement("de305d54-75b4-431b-adb2-eb6b9e546013");
|
||||||
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
|
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
|
||||||
assertXMLEqual(xml, element.toXML(null).toString());
|
assertXMLEqual(xml, element.toXML().toString());
|
||||||
|
|
||||||
OriginIdElement parsed = OriginIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml));
|
OriginIdElement parsed = OriginIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml));
|
||||||
assertEquals(element.getId(), parsed.getId());
|
assertEquals(element.getId(), parsed.getId());
|
||||||
|
|
|
@ -46,11 +46,11 @@ public class SpoilerTest extends SmackTestSuite {
|
||||||
assertNull(empty.getHint());
|
assertNull(empty.getHint());
|
||||||
assertNull(empty.getLanguage());
|
assertNull(empty.getLanguage());
|
||||||
|
|
||||||
assertXMLEqual(xml, empty.toXML(null).toString());
|
assertXMLEqual(xml, empty.toXML().toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
||||||
assertXMLEqual(xml, parsed.toXML(null).toString());
|
assertXMLEqual(xml, parsed.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -65,12 +65,12 @@ public class SpoilerTest extends SmackTestSuite {
|
||||||
assertEquals("Love story end", withHint.getHint());
|
assertEquals("Love story end", withHint.getHint());
|
||||||
assertNull(withHint.getLanguage());
|
assertNull(withHint.getLanguage());
|
||||||
|
|
||||||
assertXMLEqual(xml, withHint.toXML(null).toString());
|
assertXMLEqual(xml, withHint.toXML().toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
||||||
|
|
||||||
assertXMLEqual(xml, parsed.toXML(null).toString());
|
assertXMLEqual(xml, parsed.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -85,13 +85,13 @@ public class SpoilerTest extends SmackTestSuite {
|
||||||
assertEquals("Der Kuchen ist eine Lüge!", i18nHint.getHint());
|
assertEquals("Der Kuchen ist eine Lüge!", i18nHint.getHint());
|
||||||
assertEquals("de", i18nHint.getLanguage());
|
assertEquals("de", i18nHint.getLanguage());
|
||||||
|
|
||||||
assertXMLEqual(xml, i18nHint.toXML(null).toString());
|
assertXMLEqual(xml, i18nHint.toXML().toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
||||||
assertEquals(i18nHint.getLanguage(), parsed.getLanguage());
|
assertEquals(i18nHint.getLanguage(), parsed.getLanguage());
|
||||||
|
|
||||||
assertXMLEqual(xml, parsed.toXML(null).toString());
|
assertXMLEqual(xml, parsed.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -211,19 +211,19 @@ public class MultipleRecipientManager {
|
||||||
if (to != null) {
|
if (to != null) {
|
||||||
for (Jid jid : to) {
|
for (Jid jid : to) {
|
||||||
packet.setTo(jid);
|
packet.setTo(jid);
|
||||||
connection.sendStanza(new PacketCopy(packet.toXML(null)));
|
connection.sendStanza(new PacketCopy(packet.toXML()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cc != null) {
|
if (cc != null) {
|
||||||
for (Jid jid : cc) {
|
for (Jid jid : cc) {
|
||||||
packet.setTo(jid);
|
packet.setTo(jid);
|
||||||
connection.sendStanza(new PacketCopy(packet.toXML(null)));
|
connection.sendStanza(new PacketCopy(packet.toXML()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bcc != null) {
|
if (bcc != null) {
|
||||||
for (Jid jid : bcc) {
|
for (Jid jid : bcc) {
|
||||||
packet.setTo(jid);
|
packet.setTo(jid);
|
||||||
connection.sendStanza(new PacketCopy(packet.toXML(null)));
|
connection.sendStanza(new PacketCopy(packet.toXML()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,13 +309,13 @@ public class MultipleRecipientManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toXML(null).toString();
|
return toXML().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,12 +118,12 @@ public class MultipleAddresses implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder(this);
|
XmlStringBuilder buf = new XmlStringBuilder(this);
|
||||||
buf.rightAngleBracket();
|
buf.rightAngleBracket();
|
||||||
// Loop through all the addresses and append them to the string buffer
|
// Loop through all the addresses and append them to the string buffer
|
||||||
for (Address address : addresses) {
|
for (Address address : addresses) {
|
||||||
buf.append(address.toXML(null));
|
buf.append(address.toXML());
|
||||||
}
|
}
|
||||||
buf.closeElement(this);
|
buf.closeElement(this);
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -194,7 +194,7 @@ public class MultipleAddresses implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder();
|
XmlStringBuilder buf = new XmlStringBuilder();
|
||||||
buf.halfOpenElement(this).attribute("type", type);
|
buf.halfOpenElement(this).attribute("type", type);
|
||||||
buf.optAttribute("jid", jid);
|
buf.optAttribute("jid", jid);
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class AMPExtension implements ExtensionElement {
|
||||||
* Returns the XML representation of a XHTML extension according the specification.
|
* Returns the XML representation of a XHTML extension according the specification.
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append('"');
|
buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append('"');
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class AttentionExtension implements ExtensionElement {
|
||||||
* @see org.jivesoftware.smack.packet.PacketExtension#toXML()
|
* @see org.jivesoftware.smack.packet.PacketExtension#toXML()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append('<').append(getElementName()).append(" xmlns=\"").append(
|
sb.append('<').append(getElementName()).append(" xmlns=\"").append(
|
||||||
getNamespace()).append("\"/>");
|
getNamespace()).append("\"/>");
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class BlockedErrorExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
return xml;
|
return xml;
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class BoBExtension extends XHTMLExtension {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class DataPacketExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = getIQChildElementBuilder(new IQChildElementXmlStringBuilder(this));
|
XmlStringBuilder xml = getIQChildElementBuilder(new IQChildElementXmlStringBuilder(this));
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
return xml;
|
return xml;
|
||||||
|
|
|
@ -232,11 +232,11 @@ public class Bytestream extends IQ {
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
if (getToActivate() == null) {
|
if (getToActivate() == null) {
|
||||||
for (StreamHost streamHost : getStreamHosts()) {
|
for (StreamHost streamHost : getStreamHosts()) {
|
||||||
xml.append(streamHost.toXML(null));
|
xml.append(streamHost.toXML());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
xml.append(getToActivate().toXML(null));
|
xml.append(getToActivate().toXML());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case result:
|
case result:
|
||||||
|
@ -246,7 +246,7 @@ public class Bytestream extends IQ {
|
||||||
// constructions mechanisms of Bytestream
|
// constructions mechanisms of Bytestream
|
||||||
// A result from the server can also contain stream hosts
|
// A result from the server can also contain stream hosts
|
||||||
for (StreamHost host : streamHosts) {
|
for (StreamHost host : streamHosts) {
|
||||||
xml.append(host.toXML(null));
|
xml.append(host.toXML());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case get:
|
case get:
|
||||||
|
@ -325,7 +325,7 @@ public class Bytestream extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("jid", getJID());
|
xml.attribute("jid", getJID());
|
||||||
xml.attribute("host", getAddress());
|
xml.attribute("host", getAddress());
|
||||||
|
@ -375,7 +375,7 @@ public class Bytestream extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("jid", getJID());
|
xml.attribute("jid", getJID());
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
@ -418,7 +418,7 @@ public class Bytestream extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.escape(getTarget());
|
xml.escape(getTarget());
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class SimpleDirectoryPersistentCache implements EntityCapsPersistentCache
|
||||||
*/
|
*/
|
||||||
private static void writeInfoToFile(File file, DiscoverInfo info) throws IOException {
|
private static void writeInfoToFile(File file, DiscoverInfo info) throws IOException {
|
||||||
try (DataOutputStream dos = new DataOutputStream(new FileOutputStream(file))) {
|
try (DataOutputStream dos = new DataOutputStream(new FileOutputStream(file))) {
|
||||||
dos.writeUTF(info.toXML(null).toString());
|
dos.writeUTF(info.toXML().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class CapsExtension implements ExtensionElement {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("hash", hash).attribute("node", node).attribute("ver", ver);
|
xml.attribute("hash", hash).attribute("node", node).attribute("ver", ver);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class ChatStateExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
return xml;
|
return xml;
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class AdHocCommandData extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (form != null) {
|
if (form != null) {
|
||||||
xml.append(form.toXML(null));
|
xml.append(form.toXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AdHocCommandNote note : notes) {
|
for (AdHocCommandNote note : notes) {
|
||||||
|
@ -264,7 +264,7 @@ public class AdHocCommandData extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML(String enclosingNamespace) {
|
public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append('<').append(getElementName());
|
buf.append('<').append(getElementName());
|
||||||
buf.append(" xmlns=\"").append(getNamespace()).append("\"/>");
|
buf.append(" xmlns=\"").append(getNamespace()).append("\"/>");
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class DelayInformation implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("stamp", XmppDateTime.formatXEP0082Date(stamp));
|
xml.attribute("stamp", XmppDateTime.formatXEP0082Date(stamp));
|
||||||
xml.optAttribute("from", from);
|
xml.optAttribute("from", from);
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class Forwarded implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.optElement(getDelayInformation());
|
xml.optElement(getDelayInformation());
|
||||||
|
|
|
@ -214,7 +214,7 @@ public final class GeoLocation implements Serializable, ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.optElement("accuracy", accuracy);
|
xml.optElement("accuracy", accuracy);
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class Registration extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(String enclosingNamespace) {
|
public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ public final class JingleContent implements NamedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute(CREATOR_ATTRIBUTE_NAME, creator);
|
xml.attribute(CREATOR_ATTRIBUTE_NAME, creator);
|
||||||
xml.optAttribute(DISPOSITION_ATTRIBUTE_NAME, disposition);
|
xml.optAttribute(DISPOSITION_ATTRIBUTE_NAME, disposition);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
addExtraAttributes(xml);
|
addExtraAttributes(xml);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
|
@ -66,7 +66,7 @@ public abstract class JingleContentTransport implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
addExtraAttributes(xml);
|
addExtraAttributes(xml);
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue