mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-21 13:52:06 +01:00
Change Element.toXml() to toXml(String enclosingNamespace)
This commit is contained in:
parent
380f9a2b72
commit
5ab2903c32
229 changed files with 634 additions and 536 deletions
|
@ -39,6 +39,7 @@ import org.jivesoftware.smack.packet.Nonza;
|
|||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Success;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
@ -234,7 +235,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
|||
|
||||
private void sendElement(Element element) {
|
||||
try {
|
||||
send(ComposableBody.builder().setPayloadXML(element.toXML().toString()).build());
|
||||
send(ComposableBody.builder().setPayloadXML(element.toXML(StreamOpen.CLIENT_NAMESPACE).toString()).build());
|
||||
if (element instanceof Stanza) {
|
||||
firePacketSendingListeners((Stanza) element);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class Compress implements Nonza {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
xml.element("method", method);
|
||||
|
@ -77,7 +77,7 @@ public class Compress implements Nonza {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
for (String method : methods) {
|
||||
|
|
|
@ -39,7 +39,7 @@ public final class Compressed implements Nonza {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ public abstract class AbstractDebugger extends SmackDebugger {
|
|||
@Override
|
||||
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
||||
if (printInterpreted) {
|
||||
log("RCV PKT (" + connection.getConnectionCounter() + "): " + streamElement.toXML());
|
||||
log("RCV PKT (" + connection.getConnectionCounter() + "): " + streamElement.toXML(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ public class AbstractError {
|
|||
xml.closeElement("text");
|
||||
}
|
||||
for (ExtensionElement packetExtension : extensions) {
|
||||
xml.append(packetExtension.toXML());
|
||||
xml.append(packetExtension.toXML(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public abstract class AbstractTextElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.optXmlLangAttribute(lang);
|
||||
xml.rightAngleBracket();
|
||||
|
|
|
@ -89,7 +89,7 @@ public final class Bind extends IQ {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public class DefaultExtensionElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder buf = new XmlStringBuilder();
|
||||
buf.halfOpenElement(elementName).xmlnsAttribute(namespace).rightAngleBracket();
|
||||
for (String name : getNames()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright © 2014 Florian Schmaus
|
||||
* Copyright © 2014-2018 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -23,10 +23,14 @@ package org.jivesoftware.smack.packet;
|
|||
*/
|
||||
public interface Element {
|
||||
|
||||
// TODO: Add a toXML() non-parameter default method once Smack supports Java 8.
|
||||
|
||||
/**
|
||||
* Returns the XML representation of this Element.
|
||||
* Returns the XML representation of this Element. This method takes an optional argument for the enclosing
|
||||
* namespace which may be null or the empty String if the value is not known.
|
||||
*
|
||||
* @param enclosingNamespace the enclosing namespace or {@code null}.
|
||||
* @return the stanza extension as XML.
|
||||
*/
|
||||
CharSequence toXML();
|
||||
CharSequence toXML(String enclosingNamespace);
|
||||
}
|
||||
|
|
|
@ -125,8 +125,8 @@ public abstract class IQ extends Stanza {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final XmlStringBuilder toXML() {
|
||||
XmlStringBuilder buf = new XmlStringBuilder();
|
||||
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace);
|
||||
buf.halfOpenElement(IQ_ELEMENT);
|
||||
addCommonAttributes(buf);
|
||||
if (type == null) {
|
||||
|
@ -226,7 +226,7 @@ public abstract class IQ extends Stanza {
|
|||
protected final void initializeAsResultFor(IQ request) {
|
||||
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
||||
throw new IllegalArgumentException(
|
||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML(null));
|
||||
}
|
||||
setStanzaId(request.getStanzaId());
|
||||
setFrom(request.getTo());
|
||||
|
@ -275,7 +275,7 @@ public abstract class IQ extends Stanza {
|
|||
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Builder error) {
|
||||
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
||||
throw new IllegalArgumentException(
|
||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML(null));
|
||||
}
|
||||
final ErrorIQ result = new ErrorIQ(error);
|
||||
result.setStanzaId(request.getStanzaId());
|
||||
|
@ -367,6 +367,7 @@ public abstract class IQ extends Stanza {
|
|||
}
|
||||
|
||||
private IQChildElementXmlStringBuilder(String element, String namespace) {
|
||||
super("");
|
||||
prelude(element, namespace);
|
||||
this.element = element;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class Mechanisms implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
for (String mechanism : mechanisms) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jivesoftware.smack.util.Objects;
|
||||
import org.jivesoftware.smack.util.TypedCloneable;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
|
@ -474,7 +475,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder buf = new XmlStringBuilder();
|
||||
buf.halfOpenElement(ELEMENT);
|
||||
addCommonAttributes(buf);
|
||||
|
@ -491,7 +492,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
// Skip the default language
|
||||
if (subject.equals(defaultSubject))
|
||||
continue;
|
||||
buf.append(subject.toXML());
|
||||
buf.append(subject.toXML(null));
|
||||
}
|
||||
// Add the body in the default language
|
||||
Body defaultBody = getMessageBody(null);
|
||||
|
@ -503,7 +504,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
// Skip the default language
|
||||
if (body.equals(defaultBody))
|
||||
continue;
|
||||
buf.append(body.toXML());
|
||||
buf.append(body.toXML(enclosingNamespace));
|
||||
}
|
||||
buf.optElement("thread", thread);
|
||||
// Append the error subpacket if the message type is an error.
|
||||
|
@ -606,7 +607,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(getElementName()).xmllangAttribute(getLanguage()).rightAngleBracket();
|
||||
xml.escape(subject);
|
||||
|
@ -624,10 +625,31 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
public static final String ELEMENT = "body";
|
||||
public static final String NAMESPACE = StreamOpen.CLIENT_NAMESPACE;
|
||||
|
||||
enum BodyElementNamespace {
|
||||
client(StreamOpen.CLIENT_NAMESPACE),
|
||||
server(StreamOpen.SERVER_NAMESPACE),
|
||||
;
|
||||
|
||||
private final String xmlNamespace;
|
||||
|
||||
BodyElementNamespace(String xmlNamespace) {
|
||||
this.xmlNamespace = xmlNamespace;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return xmlNamespace;
|
||||
}
|
||||
}
|
||||
|
||||
private final String message;
|
||||
private final String language;
|
||||
private final BodyElementNamespace namespace;
|
||||
|
||||
private Body(String language, String message) {
|
||||
public Body(String language, String message) {
|
||||
this(language, message, BodyElementNamespace.client);
|
||||
}
|
||||
|
||||
public Body(String language, String message, BodyElementNamespace namespace) {
|
||||
if (language == null) {
|
||||
throw new NullPointerException("Language cannot be null.");
|
||||
}
|
||||
|
@ -636,6 +658,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
}
|
||||
this.language = language;
|
||||
this.message = message;
|
||||
this.namespace = Objects.requireNonNull(namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -688,13 +711,13 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
|
||||
@Override
|
||||
public String getNamespace() {
|
||||
return NAMESPACE;
|
||||
return namespace.xmlNamespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(getElementName()).xmllangAttribute(getLanguage()).rightAngleBracket();
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
|
||||
xml.xmllangAttribute(getLanguage()).rightAngleBracket();
|
||||
xml.escape(message);
|
||||
xml.closeElement(getElementName());
|
||||
return xml;
|
||||
|
|
|
@ -272,7 +272,7 @@ public final class Presence extends Stanza implements TypedCloneable<Presence> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder buf = new XmlStringBuilder();
|
||||
buf.halfOpenElement(ELEMENT);
|
||||
addCommonAttributes(buf);
|
||||
|
|
|
@ -67,7 +67,7 @@ public class Session extends SimpleIQ {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
if (optional) {
|
||||
xml.rightAngleBracket();
|
||||
|
|
|
@ -132,10 +132,6 @@ public final class StandardExtensionElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
return toXML(null);
|
||||
}
|
||||
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
if (xmlCache != null) {
|
||||
return xmlCache;
|
||||
|
|
|
@ -490,7 +490,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
|||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
// Add in all standard extension sub-packets.
|
||||
for (ExtensionElement extension : getExtensions()) {
|
||||
xml.append(extension.toXML());
|
||||
xml.append(extension.toXML(null));
|
||||
}
|
||||
return xml;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class StartTls implements Nonza {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
xml.condEmptyElement(required, "required");
|
||||
|
|
|
@ -136,11 +136,11 @@ public class StreamError extends AbstractError implements Nonza {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toXML().toString();
|
||||
return toXML(null).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.openElement(ELEMENT);
|
||||
xml.halfOpenElement(condition.toString()).xmlnsAttribute(NAMESPACE).closeEmptyElement();
|
||||
|
|
|
@ -96,8 +96,12 @@ public class StreamOpen implements Nonza {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(getElementName());
|
||||
// We always want to state 'xmlns' for stream open tags.
|
||||
xml.attribute("xmlns", enclosingNamespace);
|
||||
|
||||
xml.attribute("to", to);
|
||||
xml.attribute("xmlns:stream", "http://etherx.jabber.org/streams");
|
||||
xml.attribute("version", VERSION);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class SaslStreamElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).attribute("mechanism", mechanism).rightAngleBracket();
|
||||
xml.optAppend(authenticationText);
|
||||
|
@ -84,7 +84,7 @@ public class SaslStreamElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder().halfOpenElement(ELEMENT).xmlnsAttribute(
|
||||
NAMESPACE).rightAngleBracket();
|
||||
xml.optAppend(data);
|
||||
|
@ -120,7 +120,7 @@ public class SaslStreamElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
||||
xml.optAppend(authenticationText);
|
||||
|
@ -171,7 +171,7 @@ public class SaslStreamElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
||||
xml.optAppend(data);
|
||||
|
@ -236,7 +236,7 @@ public class SaslStreamElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
||||
xml.emptyElement(saslErrorString);
|
||||
|
@ -247,7 +247,7 @@ public class SaslStreamElements {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toXML().toString();
|
||||
return toXML(null).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2014-2017 Florian Schmaus
|
||||
* Copyright 2014-2018 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -27,13 +27,20 @@ import org.jivesoftware.smack.packet.NamedElement;
|
|||
|
||||
import org.jxmpp.util.XmppDateTime;
|
||||
|
||||
public class XmlStringBuilder implements Appendable, CharSequence {
|
||||
public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||
public static final String RIGHT_ANGLE_BRACKET = Character.toString('>');
|
||||
|
||||
private final LazyStringBuilder sb;
|
||||
|
||||
private final String enclosingNamespace;
|
||||
|
||||
public XmlStringBuilder() {
|
||||
this("");
|
||||
}
|
||||
|
||||
public XmlStringBuilder(String enclosingNamespace) {
|
||||
sb = new LazyStringBuilder();
|
||||
this.enclosingNamespace = enclosingNamespace != null ? enclosingNamespace : "";
|
||||
}
|
||||
|
||||
public XmlStringBuilder(ExtensionElement pe) {
|
||||
|
@ -47,13 +54,9 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
|||
}
|
||||
|
||||
public XmlStringBuilder(ExtensionElement ee, String enclosingNamespace) {
|
||||
this();
|
||||
this(enclosingNamespace);
|
||||
String namespace = ee.getNamespace();
|
||||
if (namespace.equals(enclosingNamespace)) {
|
||||
halfOpenElement(ee.getElementName());
|
||||
} else {
|
||||
prelude(ee);
|
||||
}
|
||||
prelude(ee);
|
||||
}
|
||||
|
||||
public XmlStringBuilder escapedElement(String name, String escapedContent) {
|
||||
|
@ -111,7 +114,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
|||
|
||||
public XmlStringBuilder element(Element element) {
|
||||
assert element != null;
|
||||
return append(element.toXML());
|
||||
return append(element.toXML(null));
|
||||
}
|
||||
|
||||
public XmlStringBuilder optElement(String name, String content) {
|
||||
|
@ -146,7 +149,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
|||
|
||||
public XmlStringBuilder optElement(Element element) {
|
||||
if (element != null) {
|
||||
append(element.toXML());
|
||||
append(element.toXML(null));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -350,8 +353,41 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
|||
return this;
|
||||
}
|
||||
|
||||
private static final class XmlNsAttribute implements CharSequence {
|
||||
private final String value;
|
||||
private final String xmlFragment;
|
||||
|
||||
private XmlNsAttribute(String value) {
|
||||
this.value = StringUtils.requireNotNullOrEmpty(value, "Value must not be null");
|
||||
this.xmlFragment = " xmlns='" + value + '\'';
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return xmlFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int length() {
|
||||
return xmlFragment.length();
|
||||
}
|
||||
|
||||
@Override
|
||||
public char charAt(int index) {
|
||||
return xmlFragment.charAt(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence subSequence(int start, int end) {
|
||||
return xmlFragment.subSequence(start, end);
|
||||
}
|
||||
}
|
||||
|
||||
public XmlStringBuilder xmlnsAttribute(String value) {
|
||||
optAttribute("xmlns", value);
|
||||
if (value != null && !enclosingNamespace.equals(value)) {
|
||||
XmlNsAttribute xmlNsAttribute = new XmlNsAttribute(value);
|
||||
append(xmlNsAttribute);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -409,7 +445,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
|||
|
||||
public XmlStringBuilder optAppend(Element element) {
|
||||
if (element != null) {
|
||||
append(element.toXML());
|
||||
append(element.toXML(enclosingNamespace));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -422,7 +458,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
|||
|
||||
public XmlStringBuilder append(Collection<? extends Element> elements) {
|
||||
for (Element element : elements) {
|
||||
append(element.toXML());
|
||||
append(element.toXML(null));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -512,14 +548,46 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
|||
* @param writer
|
||||
* @throws IOException
|
||||
*/
|
||||
public void write(Writer writer) throws IOException {
|
||||
public void write(Writer writer, String enclosingNamespace) throws IOException {
|
||||
for (CharSequence csq : sb.getAsList()) {
|
||||
if (csq instanceof XmlStringBuilder) {
|
||||
((XmlStringBuilder) csq).write(writer);
|
||||
((XmlStringBuilder) csq).write(writer, enclosingNamespace);
|
||||
}
|
||||
else if (csq instanceof XmlNsAttribute) {
|
||||
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
|
||||
if (!xmlNsAttribute.value.equals(enclosingNamespace)) {
|
||||
writer.write(xmlNsAttribute.toString());
|
||||
enclosingNamespace = xmlNsAttribute.value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
writer.write(csq.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
StringBuilder res = new StringBuilder();
|
||||
appendXmlTo(res, enclosingNamespace);
|
||||
return res;
|
||||
}
|
||||
|
||||
private void appendXmlTo(StringBuilder res, String enclosingNamespace) {
|
||||
for (CharSequence csq : sb.getAsList()) {
|
||||
if (csq instanceof XmlStringBuilder) {
|
||||
((XmlStringBuilder) csq).appendXmlTo(res, enclosingNamespace);
|
||||
}
|
||||
else if (csq instanceof XmlNsAttribute) {
|
||||
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
|
||||
if (!xmlNsAttribute.value.equals(enclosingNamespace)) {
|
||||
sb.append(xmlNsAttribute);
|
||||
enclosingNamespace = xmlNsAttribute.value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
res.append(csq);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,13 +167,13 @@ public class StanzaCollectorTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return "<packetId>" + getStanzaId() + "</packetId>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toXML();
|
||||
return toXML(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MessageTest {
|
|||
Message messageTypeInConstructor = new Message(null, Message.Type.chat);
|
||||
messageTypeInConstructor.setStanzaId(null);
|
||||
assertEquals(type, messageTypeInConstructor.getType());
|
||||
assertXMLEqual(control, messageTypeInConstructor.toXML().toString());
|
||||
assertXMLEqual(control, messageTypeInConstructor.toXML(null).toString());
|
||||
|
||||
controlBuilder = new StringBuilder();
|
||||
controlBuilder.append("<message")
|
||||
|
@ -62,7 +62,7 @@ public class MessageTest {
|
|||
Message messageTypeSet = getNewMessage();
|
||||
messageTypeSet.setType(type2);
|
||||
assertEquals(type2, messageTypeSet.getType());
|
||||
assertXMLEqual(control, messageTypeSet.toXML().toString());
|
||||
assertXMLEqual(control, messageTypeSet.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
|
@ -87,7 +87,7 @@ public class MessageTest {
|
|||
message.setSubject(messageSubject);
|
||||
|
||||
assertEquals(messageSubject, message.getSubject());
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -106,7 +106,7 @@ public class MessageTest {
|
|||
message.setBody(messageBody);
|
||||
|
||||
assertEquals(messageBody, message.getBody());
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -139,7 +139,7 @@ public class MessageTest {
|
|||
message.addBody(null, messageBody1);
|
||||
message.addBody(lang2, messageBody2);
|
||||
message.addBody(lang3, messageBody3);
|
||||
XmlUnitUtils.assertSimilar(control, message.toXML());
|
||||
XmlUnitUtils.assertSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE));
|
||||
|
||||
Collection<String> languages = message.getBodyLanguages();
|
||||
List<String> controlLanguages = new ArrayList<>();
|
||||
|
@ -183,7 +183,7 @@ public class MessageTest {
|
|||
message.setThread(messageThread);
|
||||
|
||||
assertEquals(messageThread, message.getThread());
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -201,7 +201,7 @@ public class MessageTest {
|
|||
Message message = getNewMessage();
|
||||
message.setLanguage(lang);
|
||||
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
}
|
||||
|
||||
private static Message getNewMessage() {
|
||||
|
|
|
@ -43,7 +43,7 @@ public class PresenceTest {
|
|||
Presence presenceTypeInConstructor = new Presence(type);
|
||||
presenceTypeInConstructor.setStanzaId(null);
|
||||
assertEquals(type, presenceTypeInConstructor.getType());
|
||||
assertXMLEqual(control, presenceTypeInConstructor.toXML().toString());
|
||||
assertXMLEqual(control, presenceTypeInConstructor.toXML(null).toString());
|
||||
|
||||
controlBuilder = new StringBuilder();
|
||||
controlBuilder.append("<presence")
|
||||
|
@ -56,7 +56,7 @@ public class PresenceTest {
|
|||
Presence presenceTypeSet = getNewPresence();
|
||||
presenceTypeSet.setType(type2);
|
||||
assertEquals(type2, presenceTypeSet.getType());
|
||||
assertXMLEqual(control, presenceTypeSet.toXML().toString());
|
||||
assertXMLEqual(control, presenceTypeSet.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
|
@ -90,7 +90,7 @@ public class PresenceTest {
|
|||
presence.setStatus(status);
|
||||
|
||||
assertEquals(status, presence.getStatus());
|
||||
assertXMLEqual(control, presence.toXML().toString());
|
||||
assertXMLEqual(control, presence.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -109,7 +109,7 @@ public class PresenceTest {
|
|||
presence.setPriority(priority);
|
||||
|
||||
assertEquals(priority, presence.getPriority());
|
||||
assertXMLEqual(control, presence.toXML().toString());
|
||||
assertXMLEqual(control, presence.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
@ -142,7 +142,7 @@ public class PresenceTest {
|
|||
mode1);
|
||||
presenceModeInConstructor.setStanzaId(null);
|
||||
assertEquals(mode1, presenceModeInConstructor.getMode());
|
||||
assertXMLEqual(control, presenceModeInConstructor.toXML().toString());
|
||||
assertXMLEqual(control, presenceModeInConstructor.toXML(null).toString());
|
||||
|
||||
controlBuilder = new StringBuilder();
|
||||
controlBuilder.append("<presence>")
|
||||
|
@ -155,7 +155,7 @@ public class PresenceTest {
|
|||
Presence presenceModeSet = getNewPresence();
|
||||
presenceModeSet.setMode(mode2);
|
||||
assertEquals(mode2, presenceModeSet.getMode());
|
||||
assertXMLEqual(control, presenceModeSet.toXML().toString());
|
||||
assertXMLEqual(control, presenceModeSet.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -183,7 +183,7 @@ public class PresenceTest {
|
|||
Presence presence = getNewPresence();
|
||||
presence.setLanguage(lang);
|
||||
|
||||
assertXMLEqual(control, presence.toXML().toString());
|
||||
assertXMLEqual(control, presence.toXML(null).toString());
|
||||
}
|
||||
|
||||
private static Presence getNewPresence() {
|
||||
|
|
|
@ -32,7 +32,7 @@ public class StandardExtensionElementParserTest {
|
|||
builder.addAttribute("attr1", "attr1-value");
|
||||
builder.addElement(StandardExtensionElement.builder("bar", "ns2").addAttribute("attr2", "attr2-value").build());
|
||||
builder.addElement("another-element", "another-element-text");
|
||||
final String elementString = builder.build().toXML().toString();
|
||||
final String elementString = builder.build().toXML(null).toString();
|
||||
|
||||
StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString));
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class StandardExtensionElementParserTest {
|
|||
|
||||
assertEquals("another-element-text", parsedElement.getFirstElement("another-element").getText());
|
||||
|
||||
String parsedElementString = parsedElement.toXML().toString();
|
||||
String parsedElementString = parsedElement.toXML(null).toString();
|
||||
assertEquals(elementString, parsedElementString);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class StandardExtensionElementParserTest {
|
|||
Builder builder = StandardExtensionElement.builder("foo", "ns1-value");
|
||||
builder.addAttribute("xmlns:ns2", "ns2-value");
|
||||
builder.addAttribute("ns2:bar", "bar-ns2-value");
|
||||
final String elementString = builder.build().toXML().toString();
|
||||
final String elementString = builder.build().toXML(null).toString();
|
||||
|
||||
StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString));
|
||||
assertEquals("foo", parsedElement.getElementName());
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.jivesoftware.smack.packet.Message;
|
|||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.sasl.SASLError;
|
||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements;
|
||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
||||
|
@ -82,7 +83,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getBodyLanguages().isEmpty());
|
||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||
assertNull(message.getBody(otherLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has non-default language, body has no language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -101,7 +102,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getBodyLanguages().isEmpty());
|
||||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||
assertNull(message.getBody(defaultLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has no language, body has no language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -119,7 +120,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getBodyLanguages().isEmpty());
|
||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||
assertNull(message.getBody(otherLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has no language, body has default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -140,7 +141,7 @@ public class PacketParserUtilsTest {
|
|||
assertNull(message.getBody(otherLanguage));
|
||||
|
||||
// body attribute xml:lang is unnecessary
|
||||
assertXMLNotEqual(control, message.toXML().toString());
|
||||
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has no language, body has non-default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -160,7 +161,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
||||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||
assertNull(message.getBody(defaultLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
|
||||
// message has default language, body has non-default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -181,7 +182,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
||||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||
assertNull(message.getBody(defaultLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
|
||||
// message has non-default language, body has default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -202,7 +203,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getBodyLanguages().contains(defaultLanguage));
|
||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||
assertNull(message.getBody(otherLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
|
||||
}
|
||||
|
||||
|
@ -231,7 +232,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getSubjectLanguages().isEmpty());
|
||||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||
assertNull(message.getSubject(otherLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has non-default language, subject has no language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -250,7 +251,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getSubjectLanguages().isEmpty());
|
||||
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
||||
assertNull(message.getSubject(defaultLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has no language, subject has no language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -268,7 +269,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getSubjectLanguages().isEmpty());
|
||||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||
assertNull(message.getSubject(otherLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has no language, subject has default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -289,7 +290,7 @@ public class PacketParserUtilsTest {
|
|||
assertNull(message.getSubject(otherLanguage));
|
||||
|
||||
// subject attribute xml:lang is unnecessary
|
||||
assertXMLNotEqual(control, message.toXML().toString());
|
||||
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has no language, subject has non-default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -309,7 +310,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getSubjectLanguages().contains(otherLanguage));
|
||||
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
||||
assertNull(message.getSubject(defaultLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has default language, subject has non-default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -330,7 +331,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getSubjectLanguages().contains(otherLanguage));
|
||||
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
||||
assertNull(message.getSubject(defaultLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has non-default language, subject has default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -351,7 +352,7 @@ public class PacketParserUtilsTest {
|
|||
assertTrue(message.getSubjectLanguages().contains(defaultLanguage));
|
||||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||
assertNull(message.getSubject(otherLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
}
|
||||
|
||||
|
@ -386,7 +387,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(2, message.getBodies().size());
|
||||
assertEquals(1, message.getBodyLanguages().size());
|
||||
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
|
||||
// message has default language, first body no language, second body default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -410,7 +411,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||
assertEquals(1, message.getBodies().size());
|
||||
assertEquals(0, message.getBodyLanguages().size());
|
||||
assertXMLNotEqual(control, message.toXML().toString());
|
||||
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has non-default language, first body no language, second body default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -435,7 +436,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(2, message.getBodies().size());
|
||||
assertEquals(1, message.getBodyLanguages().size());
|
||||
assertTrue(message.getBodyLanguages().contains(defaultLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
|
||||
// message has no language, first body no language, second body default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -458,7 +459,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||
assertEquals(1, message.getBodies().size());
|
||||
assertEquals(0, message.getBodyLanguages().size());
|
||||
assertXMLNotEqual(control, message.toXML().toString());
|
||||
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has no language, first body no language, second body other language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -482,7 +483,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||
assertEquals(2, message.getBodies().size());
|
||||
assertEquals(1, message.getBodyLanguages().size());
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
|
||||
// message has no language, first body no language, second body no language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -504,7 +505,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||
assertEquals(1, message.getBodies().size());
|
||||
assertEquals(0, message.getBodyLanguages().size());
|
||||
assertXMLNotEqual(control, message.toXML().toString());
|
||||
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||
|
||||
}
|
||||
|
||||
|
@ -539,7 +540,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(2, message.getSubjects().size());
|
||||
assertEquals(1, message.getSubjectLanguages().size());
|
||||
assertTrue(message.getSubjectLanguages().contains(otherLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has default language, first subject no language, second subject default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -563,7 +564,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||
assertEquals(1, message.getSubjects().size());
|
||||
assertEquals(0, message.getSubjectLanguages().size());
|
||||
assertXMLNotEqual(control, message.toXML().toString());
|
||||
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has non-default language, first subject no language, second subject default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -588,7 +589,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(2, message.getSubjects().size());
|
||||
assertEquals(1, message.getSubjectLanguages().size());
|
||||
assertTrue(message.getSubjectLanguages().contains(defaultLanguage));
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has no language, first subject no language, second subject default language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -611,7 +612,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||
assertEquals(1, message.getSubjects().size());
|
||||
assertEquals(0, message.getSubjectLanguages().size());
|
||||
assertXMLNotEqual(control, message.toXML().toString());
|
||||
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has no language, first subject no language, second subject other language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -635,7 +636,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
||||
assertEquals(2, message.getSubjects().size());
|
||||
assertEquals(1, message.getSubjectLanguages().size());
|
||||
assertXMLEqual(control, message.toXML().toString());
|
||||
assertXMLEqual(control, message.toXML(null).toString());
|
||||
|
||||
// message has no language, first subject no language, second subject no language
|
||||
control = XMLBuilder.create("message")
|
||||
|
@ -657,7 +658,7 @@ public class PacketParserUtilsTest {
|
|||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||
assertEquals(1, message.getSubjects().size());
|
||||
assertEquals(0, message.getSubjectLanguages().size());
|
||||
assertXMLNotEqual(control, message.toXML().toString());
|
||||
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||
|
||||
}
|
||||
|
||||
|
@ -684,7 +685,7 @@ public class PacketParserUtilsTest {
|
|||
|
||||
Message message = PacketParserUtils.parseMessage(TestUtils.getMessageParser(control));
|
||||
|
||||
fail("Should throw exception. Instead got message: " + message.toXML().toString());
|
||||
fail("Should throw exception. Instead got message: " + message.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -749,7 +750,7 @@ public class PacketParserUtilsTest {
|
|||
.asString(outputProperties);
|
||||
|
||||
Stanza message = PacketParserUtils.parseStanza(control);
|
||||
XmlUnitUtils.assertSimilar(control, message.toXML());
|
||||
XmlUnitUtils.assertSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -759,7 +760,7 @@ public class PacketParserUtilsTest {
|
|||
|
||||
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
||||
|
||||
assertXMLEqual(stanza, presence.toXML().toString());
|
||||
assertXMLEqual(stanza, presence.toXML(null).toString());
|
||||
// CHECKSTYLE:ON
|
||||
}
|
||||
|
||||
|
@ -770,7 +771,7 @@ public class PacketParserUtilsTest {
|
|||
|
||||
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
||||
|
||||
assertXMLEqual(stanza, presence.toXML().toString());
|
||||
assertXMLEqual(stanza, presence.toXML(null).toString());
|
||||
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
||||
// CHECKSTYLE:ON
|
||||
}
|
||||
|
@ -785,7 +786,7 @@ public class PacketParserUtilsTest {
|
|||
+ "</presence>";
|
||||
|
||||
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
||||
assertXMLEqual(stanza, presence.toXML().toString());
|
||||
assertXMLEqual(stanza, presence.toXML(null).toString());
|
||||
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
||||
assertEquals("dnd", presence.getMode().name());
|
||||
assertEquals("en", presence.getLanguage());
|
||||
|
@ -851,7 +852,7 @@ public class PacketParserUtilsTest {
|
|||
// @formatter:on
|
||||
XmlPullParser parser = TestUtils.getParser(saslFailureString, SASLFailure.ELEMENT);
|
||||
SASLFailure saslFailure = PacketParserUtils.parseSASLFailure(parser);
|
||||
XmlUnitUtils.assertSimilar(saslFailureString, saslFailure.toXML());
|
||||
XmlUnitUtils.assertSimilar(saslFailureString, saslFailure.toXML(StreamOpen.CLIENT_NAMESPACE));
|
||||
}
|
||||
|
||||
@SuppressWarnings("ReferenceEquality")
|
||||
|
|
|
@ -113,14 +113,14 @@ public class SLF4JSmackDebugger extends SmackDebugger {
|
|||
@Override
|
||||
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
||||
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
|
||||
logger.debug("IN {}: {}", streamElement.getClass().getName(), streamElement.toXML());
|
||||
logger.debug("IN {}: {}", streamElement.getClass().getName(), streamElement.toXML(null));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOutgoingStreamElement(TopLevelStreamElement streamElement) {
|
||||
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
|
||||
logger.debug("OUT {}: {}", streamElement.getClass().getName(), streamElement.toXML());
|
||||
logger.debug("OUT {}: {}", streamElement.getClass().getName(), streamElement.toXML(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -818,7 +818,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
|||
|
||||
messagesTable.addRow(
|
||||
new Object[] {
|
||||
XmlUtil.prettyFormatXml(packet.toXML().toString()),
|
||||
XmlUtil.prettyFormatXml(packet.toXML(null).toString()),
|
||||
dateFormatter.format(new Date()),
|
||||
packetReceivedIcon,
|
||||
packetTypeIcon,
|
||||
|
@ -889,7 +889,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
|||
|
||||
messagesTable.addRow(
|
||||
new Object[] {
|
||||
XmlUtil.prettyFormatXml(packet.toXML().toString()),
|
||||
XmlUtil.prettyFormatXml(packet.toXML(null).toString()),
|
||||
dateFormatter.format(new Date()),
|
||||
packetSentIcon,
|
||||
packetTypeIcon,
|
||||
|
@ -946,13 +946,13 @@ public class EnhancedDebugger extends SmackDebugger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toXML();
|
||||
return toXML(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -331,8 +331,8 @@ public class LiteDebugger extends SmackDebugger {
|
|||
|
||||
@Override
|
||||
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
||||
interpretedText1.append(streamElement.toXML().toString());
|
||||
interpretedText2.append(streamElement.toXML().toString());
|
||||
interpretedText1.append(streamElement.toXML(null).toString());
|
||||
interpretedText2.append(streamElement.toXML(null).toString());
|
||||
interpretedText1.append(NEWLINE);
|
||||
interpretedText2.append(NEWLINE);
|
||||
}
|
||||
|
|
|
@ -79,10 +79,10 @@ public class CarbonExtension implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
xml.append(fwd.toXML());
|
||||
xml.append(fwd.toXML(null));
|
||||
xml.closeElement(this);
|
||||
return xml;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public class CarbonExtension implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return "<" + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ChatMarkersElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.closeEmptyElement();
|
||||
return xml;
|
||||
|
@ -113,7 +113,7 @@ public class ChatMarkersElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("id", id);
|
||||
xml.closeEmptyElement();
|
||||
|
@ -166,7 +166,7 @@ public class ChatMarkersElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("id", id);
|
||||
xml.closeEmptyElement();
|
||||
|
@ -219,7 +219,7 @@ public class ChatMarkersElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("id", id);
|
||||
xml.closeEmptyElement();
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ClientStateIndication {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class ClientStateIndication {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class ClientStateIndication {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ public class ExplicitMessageEncryptionElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("namespace", getEncryptionNamespace());
|
||||
xml.optAttribute("name", getName());
|
||||
|
|
|
@ -93,7 +93,7 @@ public class HashElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||
sb.attribute(ATTR_ALGO, algorithm.toString());
|
||||
sb.rightAngleBracket();
|
||||
|
@ -117,6 +117,6 @@ public class HashElement implements ExtensionElement {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return toXML().toString().hashCode();
|
||||
return toXML(null).toString().hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class NoCopyHint extends MessageProcessingHint {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class NoPermanentStoreHint extends MessageProcessingHint {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class NoStoreHint extends MessageProcessingHint {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class StoreHint extends MessageProcessingHint {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
|||
* @return xml representation of this object
|
||||
*/
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
xml.element(child);
|
||||
|
@ -215,7 +215,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
xml.optAppend(text);
|
||||
|
@ -259,7 +259,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
xml.optAppend(text);
|
||||
|
@ -303,7 +303,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
xml.optAppend(text);
|
||||
|
@ -347,7 +347,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("streamId", streamId);
|
||||
xml.closeEmptyElement();
|
||||
|
@ -390,7 +390,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("sid", sid);
|
||||
xml.closeEmptyElement();
|
||||
|
|
|
@ -117,7 +117,7 @@ public class Base64BinaryChunk implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("streamId", streamId);
|
||||
xml.attribute("nr", nr);
|
||||
|
|
|
@ -58,7 +58,7 @@ public class FileTooLargeError implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
xml.element("max-file-size", String.valueOf(maxFileSize));
|
||||
|
|
|
@ -82,7 +82,7 @@ public abstract class SetData implements NamedElement {
|
|||
* @return the stanza extension as XML.
|
||||
*/
|
||||
@Override
|
||||
public final XmlStringBuilder toXML() {
|
||||
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("name", name);
|
||||
xml.attribute("value", value);
|
||||
|
|
|
@ -52,7 +52,7 @@ public abstract class IoTDataField implements NamedElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final XmlStringBuilder toXML() {
|
||||
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("name", name).attribute("value", getValueString());
|
||||
// TODO handle 'unit' attribute as special case if <numeric/> is implemented.
|
||||
|
|
|
@ -68,7 +68,7 @@ public class IoTFieldsExtension implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("seqnr", Integer.toString(seqNr));
|
||||
xml.attribute("done", done);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class NodeElement implements NamedElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
nodeInfo.appendTo(xml);
|
||||
xml.rightAngleBracket();
|
||||
|
|
|
@ -45,7 +45,7 @@ public class TimestampElement implements NamedElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("value", date);
|
||||
xml.rightAngleBracket();
|
||||
|
|
|
@ -58,7 +58,7 @@ public class Tag implements NamedElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("name", name);
|
||||
xml.attribute("value", value);
|
||||
|
|
|
@ -45,7 +45,7 @@ public class Friend implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("jid", friend);
|
||||
xml.closeEmptyElement();
|
||||
|
|
|
@ -47,7 +47,7 @@ public class Unfriend implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("jid", jid);
|
||||
xml.closeEmptyElement();
|
||||
|
|
|
@ -46,7 +46,7 @@ public class Checksum implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||
sb.optAttribute(ATTR_CREATOR, creator);
|
||||
sb.optAttribute(ATTR_NAME, name);
|
||||
|
|
|
@ -86,7 +86,7 @@ public class JingleFileTransferChild extends JingleContentDescriptionChildElemen
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||
sb.rightAngleBracket();
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public class Range implements NamedElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||
|
||||
if (offset > 0) {
|
||||
|
@ -130,6 +130,6 @@ public class Range implements NamedElement {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return toXML().toString().hashCode();
|
||||
return toXML(null).toString().hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public abstract class AbstractJsonPacketExtension implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final XmlStringBuilder toXML() {
|
||||
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
xml.append(json);
|
||||
|
|
|
@ -126,7 +126,7 @@ public class MamElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(this);
|
||||
xml.xmlnsAttribute(NAMESPACE);
|
||||
|
@ -167,7 +167,7 @@ public class MamElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.openElement("always");
|
||||
|
||||
|
@ -201,7 +201,7 @@ public class MamElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.openElement("never");
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class BlockQuoteElement implements MarkupElement.BlockLevelMarkupElement
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(this);
|
||||
xml.attribute(ATTR_START, getStart());
|
||||
|
|
|
@ -51,7 +51,7 @@ public class CodeBlockElement implements MarkupElement.BlockLevelMarkupElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(this);
|
||||
xml.attribute(ATTR_START, getStart());
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ListElement implements MarkupElement.MarkupChildElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(this);
|
||||
xml.attribute(ATTR_START, getStart());
|
||||
|
@ -76,7 +76,7 @@ public class ListElement implements MarkupElement.MarkupChildElement {
|
|||
xml.rightAngleBracket();
|
||||
|
||||
for (ListEntryElement li : getEntries()) {
|
||||
xml.append(li.toXML());
|
||||
xml.append(li.toXML(null));
|
||||
}
|
||||
|
||||
xml.closeElement(this);
|
||||
|
@ -110,7 +110,7 @@ public class ListElement implements MarkupElement.MarkupChildElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(this);
|
||||
xml.attribute(ATTR_START, getStart());
|
||||
|
|
|
@ -68,11 +68,11 @@ public class MarkupElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket();
|
||||
|
||||
for (MarkupChildElement child : getChildElements()) {
|
||||
xml.append(child.toXML());
|
||||
xml.append(child.toXML(null));
|
||||
}
|
||||
|
||||
xml.closeElement(this);
|
||||
|
|
|
@ -76,7 +76,7 @@ public class SpanElement implements MarkupElement.MarkupChildElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(this);
|
||||
xml.attribute(ATTR_START, getStart());
|
||||
|
|
|
@ -94,7 +94,7 @@ public abstract class MUCLightElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
|
||||
|
@ -208,7 +208,7 @@ public abstract class MUCLightElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
|
||||
|
@ -255,7 +255,7 @@ public abstract class MUCLightElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.openElement("configuration");
|
||||
|
||||
|
@ -296,7 +296,7 @@ public abstract class MUCLightElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.openElement("occupants");
|
||||
|
||||
|
@ -335,7 +335,7 @@ public abstract class MUCLightElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement("user");
|
||||
xml.attribute("affiliation", affiliation);
|
||||
|
@ -373,7 +373,7 @@ public abstract class MUCLightElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
|
||||
String tag = isRoom ? "room" : "user";
|
||||
|
|
|
@ -78,7 +78,7 @@ public class PushNotificationsElements {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
|
||||
xml.attribute("node", node);
|
||||
|
|
|
@ -174,7 +174,7 @@ public class ReferenceElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this)
|
||||
.optIntAttribute(ATTR_BEGIN, begin != null ? begin : -1)
|
||||
.optIntAttribute(ATTR_END, end != null ? end : -1)
|
||||
|
@ -186,7 +186,7 @@ public class ReferenceElement implements ExtensionElement {
|
|||
return xml.closeEmptyElement();
|
||||
} else {
|
||||
return xml.rightAngleBracket()
|
||||
.append(child.toXML())
|
||||
.append(child.toXML(null))
|
||||
.closeElement(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class OriginIdElement extends StableAndUniqueIdElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
return new XmlStringBuilder(this)
|
||||
.attribute(ATTR_ID, getId())
|
||||
.closeEmptyElement();
|
||||
|
|
|
@ -72,7 +72,7 @@ public class StanzaIdElement extends StableAndUniqueIdElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
return new XmlStringBuilder(this)
|
||||
.attribute(ATTR_ID, getId())
|
||||
.attribute(ATTR_BY, getBy())
|
||||
|
|
|
@ -151,7 +151,7 @@ public class SpoilerElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.optXmlLangAttribute(getLanguage());
|
||||
if (getHint() == null) {
|
||||
|
|
|
@ -40,7 +40,7 @@ public class AcknowledgedExtensionTest {
|
|||
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
|
||||
message.setStanzaId("message-2");
|
||||
message.addExtension(new ChatMarkersElements.AcknowledgedExtension("message-1"));
|
||||
Assert.assertEquals(acknowledgedMessageStanza, message.toXML().toString());
|
||||
Assert.assertEquals(acknowledgedMessageStanza, message.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -40,7 +40,7 @@ public class DisplayedExtensionTest {
|
|||
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
|
||||
message.setStanzaId("message-2");
|
||||
message.addExtension(new ChatMarkersElements.DisplayedExtension("message-1"));
|
||||
Assert.assertEquals(displayedMessageStanza, message.toXML().toString());
|
||||
Assert.assertEquals(displayedMessageStanza, message.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -42,18 +42,18 @@ public class MarkableExtensionTest {
|
|||
message.setStanzaId("message-1");
|
||||
message.setBody("My lord, dispatch; read o'er these articles.");
|
||||
message.addExtension(new ChatMarkersElements.MarkableExtension());
|
||||
Assert.assertEquals(markableMessageStanza, message.toXML().toString());
|
||||
Assert.assertEquals(markableMessageStanza, message.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkMarkableProvider() throws Exception {
|
||||
XmlPullParser parser = PacketParserUtils.getParserFor(markableExtension);
|
||||
MarkableExtension markableExtension1 = new MarkableProvider().parse(parser);
|
||||
Assert.assertEquals(markableExtension, markableExtension1.toXML().toString());
|
||||
Assert.assertEquals(markableExtension, markableExtension1.toXML(null).toString());
|
||||
|
||||
Message message = PacketParserUtils.parseStanza(markableMessageStanza);
|
||||
MarkableExtension markableExtension2 = MarkableExtension.from(message);
|
||||
Assert.assertEquals(markableExtension, markableExtension2.toXML().toString());
|
||||
Assert.assertEquals(markableExtension, markableExtension2.toXML(null).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ReceivedExtensionTest {
|
|||
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
|
||||
message.setStanzaId("message-2");
|
||||
message.addExtension(new ChatMarkersElements.ReceivedExtension("message-1"));
|
||||
Assert.assertEquals(receivedMessageStanza, message.toXML().toString());
|
||||
Assert.assertEquals(receivedMessageStanza, message.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -41,10 +41,10 @@ public class HashElementTest extends SmackTestSuite {
|
|||
String message = "Hello World!";
|
||||
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>";
|
||||
assertEquals(expected, element.toXML().toString());
|
||||
assertEquals(expected, element.toXML(null).toString());
|
||||
|
||||
HashElement parsed = new HashElementProvider().parse(TestUtils.getParser(expected));
|
||||
assertEquals(expected, parsed.toXML().toString());
|
||||
assertEquals(expected, parsed.toXML(null).toString());
|
||||
assertEquals(SHA_256, parsed.getAlgorithm());
|
||||
assertEquals("f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=", parsed.getHashB64());
|
||||
assertArrayEquals(HashManager.sha_256(message), parsed.getHash());
|
||||
|
|
|
@ -32,7 +32,7 @@ public class FileTooLargeErrorCreateTest {
|
|||
FileTooLargeError fileTooLargeError = new FileTooLargeError(20000);
|
||||
|
||||
Assert.assertEquals(20000, fileTooLargeError.getMaxFileSize());
|
||||
Assert.assertEquals(fileTooLargeErrorExtensionExample, fileTooLargeError.toXML().toString());
|
||||
Assert.assertEquals(fileTooLargeErrorExtensionExample, fileTooLargeError.toXML(null).toString());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class SlotProviderTest {
|
|||
|
||||
checkUrls(slot);
|
||||
|
||||
assertXMLEqual(SLOT_IQ, slot.toXML().toString());
|
||||
assertXMLEqual(SLOT_IQ, slot.toXML(null).toString());
|
||||
}
|
||||
|
||||
private static final String SLOT_V0_2_IQ =
|
||||
|
@ -88,7 +88,7 @@ public class SlotProviderTest {
|
|||
|
||||
checkUrls(slot);
|
||||
|
||||
String slotXml = slot.toXML().toString();
|
||||
String slotXml = slot.toXML(null).toString();
|
||||
assertXMLEqual(SLOT_V0_2_IQ, slotXml);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class SlotProviderTest {
|
|||
|
||||
checkUrls(slot);
|
||||
|
||||
String slotXml = slot.toXML().toString();
|
||||
String slotXml = slot.toXML(null).toString();
|
||||
assertXMLEqual(SLOT_WITH_HEADERS_IQ, slotXml);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class FiltersTest extends MamTest {
|
|||
List<String> values = new ArrayList<>();
|
||||
values.add(XmppDateTime.formatXEP0082Date(date));
|
||||
|
||||
Assert.assertEquals(dataForm.toXML().toString(), getMamXMemberWith(fields, values));
|
||||
Assert.assertEquals(dataForm.toXML(null).toString(), getMamXMemberWith(fields, values));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -76,7 +76,7 @@ public class FiltersTest extends MamTest {
|
|||
List<String> values = new ArrayList<>();
|
||||
values.add(XmppDateTime.formatXEP0082Date(date));
|
||||
|
||||
Assert.assertEquals(dataForm.toXML().toString(), getMamXMemberWith(fields, values));
|
||||
Assert.assertEquals(dataForm.toXML(null).toString(), getMamXMemberWith(fields, values));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -93,7 +93,7 @@ public class FiltersTest extends MamTest {
|
|||
List<String> values = new ArrayList<>();
|
||||
values.add(jid);
|
||||
|
||||
Assert.assertEquals(dataForm.toXML().toString(), getMamXMemberWith(fields, values));
|
||||
Assert.assertEquals(dataForm.toXML(null).toString(), getMamXMemberWith(fields, values));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -113,7 +113,7 @@ public class FiltersTest extends MamTest {
|
|||
methodAddStartDateFilter.invoke(mamManager, date, dataForm);
|
||||
methodAddEndDateFilter.invoke(mamManager, date, dataForm);
|
||||
methodAddJidFilter.invoke(mamManager, JidCreate.from(jid), dataForm);
|
||||
String dataFormResult = dataForm.toXML().toString();
|
||||
String dataFormResult = dataForm.toXML(null).toString();
|
||||
|
||||
List<String> fields = new ArrayList<>();
|
||||
List<String> values = new ArrayList<>();
|
||||
|
|
|
@ -45,7 +45,7 @@ public class PagingTest extends MamTest {
|
|||
|
||||
Assert.assertEquals(mamQueryIQ.getDataForm(), dataForm);
|
||||
Assert.assertEquals(mamQueryIQ.getDataForm().getFields().get(0).getValues().get(0), "urn:xmpp:mam:1");
|
||||
Assert.assertEquals(mamQueryIQ.toXML().toString(), pagingStanza);
|
||||
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), pagingStanza);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class PreferencesTest {
|
|||
public void checkRetrievePrefsStanza() throws Exception {
|
||||
MamPrefsIQ mamPrefIQ = new MamPrefsIQ();
|
||||
mamPrefIQ.setStanzaId("sarasa");
|
||||
Assert.assertEquals(mamPrefIQ.toXML().toString(), retrievePrefsStanzaExample);
|
||||
Assert.assertEquals(mamPrefIQ.toXML(null).toString(), retrievePrefsStanzaExample);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -55,7 +55,7 @@ public class PreferencesTest {
|
|||
|
||||
MamPrefsIQ mamPrefIQ = new MamPrefsIQ(alwaysJids, neverJids, DefaultBehavior.roster);
|
||||
mamPrefIQ.setStanzaId("sarasa");
|
||||
Assert.assertEquals(mamPrefIQ.toXML().toString(), updatePrefsStanzaExample);
|
||||
Assert.assertEquals(mamPrefIQ.toXML(null).toString(), updatePrefsStanzaExample);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class QueryArchiveTest extends MamTest {
|
|||
MamQueryIQ mamQueryIQ = new MamQueryIQ(queryId, dataForm);
|
||||
mamQueryIQ.setType(IQ.Type.set);
|
||||
mamQueryIQ.setStanzaId("sarasa");
|
||||
Assert.assertEquals(mamQueryIQ.toXML().toString(), mamSimpleQueryIQ);
|
||||
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), mamSimpleQueryIQ);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -80,7 +80,7 @@ public class QueryArchiveTest extends MamTest {
|
|||
|
||||
message.addExtension(new MamResultExtension("g27", "34482-21985-73620", forwarded));
|
||||
|
||||
Assert.assertEquals(message.toXML().toString(), mamQueryResultExample);
|
||||
Assert.assertEquals(message.toXML(null).toString(), mamQueryResultExample);
|
||||
|
||||
MamResultExtension mamResultExtension = MamResultExtension.from(message);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ResultsLimitTest extends MamTest {
|
|||
mamQueryIQ.setStanzaId("sarasa");
|
||||
|
||||
methodAddResultsLimit.invoke(mamManager, 10, mamQueryIQ);
|
||||
Assert.assertEquals(mamQueryIQ.toXML().toString(), resultsLimitStanza);
|
||||
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), resultsLimitStanza);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class RetrieveFormFieldsTest extends MamTest {
|
|||
MamQueryIQ mamQueryIQ = new MamQueryIQ(queryId);
|
||||
mamQueryIQ.setStanzaId("sarasa");
|
||||
|
||||
Assert.assertEquals(mamQueryIQ.toXML().toString(), retrieveFormFieldStanza);
|
||||
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), retrieveFormFieldStanza);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -70,7 +70,7 @@ public class RetrieveFormFieldsTest extends MamTest {
|
|||
|
||||
methodAddAdditionalFields.invoke(mamManager, additionalFields, dataForm);
|
||||
|
||||
String dataFormResult = dataForm.toXML().toString();
|
||||
String dataFormResult = dataForm.toXML(null).toString();
|
||||
|
||||
Assert.assertEquals(dataFormResult, additionalFieldsStanza);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
|||
"</markup>";
|
||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||
m.setEmphasis(9, 15);
|
||||
assertXMLEqual(xml, m.build().toXML().toString());
|
||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||
|
@ -69,7 +69,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
|||
"</markup>";
|
||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||
m.setCode(9, 15);
|
||||
assertXMLEqual(xml, m.build().toXML().toString());
|
||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||
|
@ -93,7 +93,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
|||
"</markup>";
|
||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||
m.setDeleted(9, 15);
|
||||
assertXMLEqual(xml, m.build().toXML().toString());
|
||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||
|
@ -127,7 +127,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
|||
"</markup>";
|
||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||
m.setCodeBlock(23, 48);
|
||||
assertXMLEqual(xml, m.build().toXML().toString());
|
||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||
|
@ -157,7 +157,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
|||
.addEntry(61, 69)
|
||||
.addEntry(69, 89)
|
||||
.endList();
|
||||
assertXMLEqual(xml, m.build().toXML().toString());
|
||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||
|
@ -186,7 +186,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
|||
"</markup>";
|
||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||
m.setBlockQuote(9 ,32);
|
||||
assertXMLEqual(xml, m.build().toXML().toString());
|
||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||
|
@ -208,7 +208,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
|||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||
m.setBlockQuote(0, 57);
|
||||
m.setBlockQuote(11, 34);
|
||||
assertXMLEqual(xml, m.build().toXML().toString());
|
||||
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class MUCLightBlockingTest {
|
|||
mucLightBlockingIQ.setStanzaId("getblock1");
|
||||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
|
||||
Assert.assertEquals(getBlockingListIQExample, mucLightBlockingIQ.toXML().toString());
|
||||
Assert.assertEquals(getBlockingListIQExample, mucLightBlockingIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -88,7 +88,7 @@ public class MUCLightBlockingTest {
|
|||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
mucLightBlockingIQ.setStanzaId("block1");
|
||||
|
||||
Assert.assertEquals(blockingRoomsIQExample, mucLightBlockingIQ.toXML().toString());
|
||||
Assert.assertEquals(blockingRoomsIQExample, mucLightBlockingIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -102,7 +102,7 @@ public class MUCLightBlockingTest {
|
|||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
mucLightBlockingIQ.setStanzaId("block2");
|
||||
|
||||
Assert.assertEquals(blockingUsersIQExample, mucLightBlockingIQ.toXML().toString());
|
||||
Assert.assertEquals(blockingUsersIQExample, mucLightBlockingIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -118,7 +118,7 @@ public class MUCLightBlockingTest {
|
|||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
mucLightBlockingIQ.setStanzaId("unblock1");
|
||||
|
||||
Assert.assertEquals(unblockingUsersAndRoomsExample, mucLightBlockingIQ.toXML().toString());
|
||||
Assert.assertEquals(unblockingUsersAndRoomsExample, mucLightBlockingIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class MUCLightConfigurationsChangeExtensionTest {
|
|||
Assert.assertEquals("To be or not to be?", configurationsChangeExtension.getSubject());
|
||||
Assert.assertNull(configurationsChangeExtension.getRoomName());
|
||||
Assert.assertNull(configurationsChangeExtension.getCustomConfigs());
|
||||
Assert.assertEquals(messageWithSubjectChangeExample, configurationsMessage.toXML().toString());
|
||||
Assert.assertEquals(messageWithSubjectChangeExample, configurationsMessage.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -65,7 +65,7 @@ public class MUCLightConfigurationsChangeExtensionTest {
|
|||
Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName());
|
||||
Assert.assertNull(configurationsChangeExtension.getSubject());
|
||||
Assert.assertNull(configurationsChangeExtension.getCustomConfigs());
|
||||
Assert.assertEquals(messageWithRoomNameChangeExample, configurationsMessage.toXML().toString());
|
||||
Assert.assertEquals(messageWithRoomNameChangeExample, configurationsMessage.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -79,7 +79,7 @@ public class MUCLightConfigurationsChangeExtensionTest {
|
|||
Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName());
|
||||
Assert.assertNull(configurationsChangeExtension.getSubject());
|
||||
Assert.assertEquals("blue", configurationsChangeExtension.getCustomConfigs().get("color"));
|
||||
Assert.assertEquals(messageWithConfigsChangeExample, configurationsMessage.toXML().toString());
|
||||
Assert.assertEquals(messageWithConfigsChangeExample, configurationsMessage.toXML(null).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class MUCLightDestroyTest {
|
|||
public void checkDestroyMUCLightStanza() throws Exception {
|
||||
MUCLightDestroyIQ mucLightDestroyIQ = new MUCLightDestroyIQ(JidCreate.from("coven@muclight.shakespeare.lit"));
|
||||
mucLightDestroyIQ.setStanzaId("destroy1");
|
||||
Assert.assertEquals(mucLightDestroyIQ.toXML().toString(), stanza);
|
||||
Assert.assertEquals(mucLightDestroyIQ.toXML(null).toString(), stanza);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class MUCLightGetAffiliationsTest {
|
|||
MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(
|
||||
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
||||
mucLightGetAffiliationsIQ.setStanzaId("getmembers");
|
||||
Assert.assertEquals(getAffiliationsIQExample, mucLightGetAffiliationsIQ.toXML().toString());
|
||||
Assert.assertEquals(getAffiliationsIQExample, mucLightGetAffiliationsIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -48,7 +48,7 @@ public class MUCLightGetConfigsTest {
|
|||
MUCLightGetConfigsIQ mucLightGetConfigsIQ = new MUCLightGetConfigsIQ(
|
||||
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
||||
mucLightGetConfigsIQ.setStanzaId("config0");
|
||||
Assert.assertEquals(getConfigsIQExample, mucLightGetConfigsIQ.toXML().toString());
|
||||
Assert.assertEquals(getConfigsIQExample, mucLightGetConfigsIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -45,7 +45,7 @@ public class MUCLightInfoTest {
|
|||
MUCLightGetInfoIQ mucLightGetInfoIQWithVersion = new MUCLightGetInfoIQ(
|
||||
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
||||
mucLightGetInfoIQWithVersion.setStanzaId("getinfo1");
|
||||
Assert.assertEquals(mucLightGetInfoIQWithVersion.toXML().toString(), exampleWithVersion);
|
||||
Assert.assertEquals(mucLightGetInfoIQWithVersion.toXML(null).toString(), exampleWithVersion);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -53,7 +53,7 @@ public class MUCLightInfoTest {
|
|||
MUCLightGetInfoIQ mucLightGetInfoIQWithoutVersion = new MUCLightGetInfoIQ(
|
||||
JidCreate.from("coven@muclight.shakespeare.lit"), null);
|
||||
mucLightGetInfoIQWithoutVersion.setStanzaId("getinfo1");
|
||||
Assert.assertEquals(mucLightGetInfoIQWithoutVersion.toXML().toString(), exampleWithoutVersion);
|
||||
Assert.assertEquals(mucLightGetInfoIQWithoutVersion.toXML(null).toString(), exampleWithoutVersion);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -47,7 +47,7 @@ public class MUCLightSetConfigsIQTest {
|
|||
JidCreate.from("coven@muclight.shakespeare.lit"), "A Darker Cave", customConfigs);
|
||||
mucLightSetConfigsIQ.setStanzaId("conf1");
|
||||
|
||||
Assert.assertEquals(setConfigsIQExample, mucLightSetConfigsIQ.toXML().toString());
|
||||
Assert.assertEquals(setConfigsIQExample, mucLightSetConfigsIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -56,7 +56,7 @@ public class MUCLightSetConfigsIQTest {
|
|||
JidCreate.from("coven@muclight.shakespeare.lit"), "A Darker Cave", null);
|
||||
mucLightChangeRoomNameIQ.setStanzaId("roomName1");
|
||||
|
||||
Assert.assertEquals(changeRoomNameIQExample, mucLightChangeRoomNameIQ.toXML().toString());
|
||||
Assert.assertEquals(changeRoomNameIQExample, mucLightChangeRoomNameIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -65,7 +65,7 @@ public class MUCLightSetConfigsIQTest {
|
|||
JidCreate.from("coven@muclight.shakespeare.lit"), null, "To be or not to be?", null);
|
||||
mucLightChangeSubjectIQ.setStanzaId("subject1");
|
||||
|
||||
Assert.assertEquals(changeSubjectIQExample, mucLightChangeSubjectIQ.toXML().toString());
|
||||
Assert.assertEquals(changeSubjectIQExample, mucLightChangeSubjectIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class DisablePushNotificationsIQTest {
|
|||
DisablePushNotificationsIQ disablePushNotificationsIQ = new DisablePushNotificationsIQ(
|
||||
JidCreate.from("push-5.client.example"));
|
||||
disablePushNotificationsIQ.setStanzaId("x97");
|
||||
Assert.assertEquals(disableAllNotificationsIQExample, disablePushNotificationsIQ.toXML().toString());
|
||||
Assert.assertEquals(disableAllNotificationsIQExample, disablePushNotificationsIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -44,7 +44,7 @@ public class DisablePushNotificationsIQTest {
|
|||
DisablePushNotificationsIQ disablePushNotificationsIQ = new DisablePushNotificationsIQ(
|
||||
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo");
|
||||
disablePushNotificationsIQ.setStanzaId("x97");
|
||||
Assert.assertEquals(disableNodeNotificationsIQExample, disablePushNotificationsIQ.toXML().toString());
|
||||
Assert.assertEquals(disableNodeNotificationsIQExample, disablePushNotificationsIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class EnablePushNotificationsIQTest {
|
|||
EnablePushNotificationsIQ enablePushNotificationsIQ = new EnablePushNotificationsIQ(
|
||||
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo");
|
||||
enablePushNotificationsIQ.setStanzaId("x42");
|
||||
Assert.assertEquals(exampleEnableIQ, enablePushNotificationsIQ.toXML().toString());
|
||||
Assert.assertEquals(exampleEnableIQ, enablePushNotificationsIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -53,7 +53,7 @@ public class EnablePushNotificationsIQTest {
|
|||
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo", publishOptions);
|
||||
enablePushNotificationsIQ.setStanzaId("x42");
|
||||
|
||||
Assert.assertEquals(exampleEnableIQWithPublishOptions, enablePushNotificationsIQ.toXML().toString());
|
||||
Assert.assertEquals(exampleEnableIQWithPublishOptions, enablePushNotificationsIQ.toXML(null).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ReferenceTest extends SmackTestSuite {
|
|||
"uri='xmpp:juliet@capulet.lit' />";
|
||||
URI uri = new URI("xmpp:juliet@capulet.lit");
|
||||
ReferenceElement element = new ReferenceElement(72, 78, ReferenceElement.Type.mention, null, uri);
|
||||
assertXMLEqual(xml, element.toXML().toString());
|
||||
assertXMLEqual(xml, element.toXML(null).toString());
|
||||
assertEquals(72, (int) element.getBegin());
|
||||
assertEquals(78, (int) element.getEnd());
|
||||
assertEquals(ReferenceElement.Type.mention, element.getType());
|
||||
|
@ -49,7 +49,7 @@ public class ReferenceTest extends SmackTestSuite {
|
|||
assertEquals(uri, element.getUri());
|
||||
|
||||
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
|
||||
assertXMLEqual(xml, parsed.toXML().toString());
|
||||
assertXMLEqual(xml, parsed.toXML(null).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 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);
|
||||
assertXMLEqual(xml, element.toXML().toString());
|
||||
assertXMLEqual(xml, element.toXML(null).toString());
|
||||
|
||||
assertNull(element.getBegin());
|
||||
assertNull(element.getEnd());
|
||||
|
@ -73,7 +73,7 @@ public class ReferenceTest extends SmackTestSuite {
|
|||
assertEquals(uri, element.getUri());
|
||||
|
||||
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
|
||||
assertXMLEqual(xml, parsed.toXML().toString());
|
||||
assertXMLEqual(xml, parsed.toXML(null).toString());
|
||||
}
|
||||
|
||||
@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");
|
||||
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
|
||||
assertEquals("alice@wonderland.lit", element.getBy());
|
||||
assertXMLEqual(xml, element.toXML().toString());
|
||||
assertXMLEqual(xml, element.toXML(null).toString());
|
||||
|
||||
StanzaIdElement parsed = StanzaIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml));
|
||||
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' />";
|
||||
OriginIdElement element = new OriginIdElement("de305d54-75b4-431b-adb2-eb6b9e546013");
|
||||
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
|
||||
assertXMLEqual(xml, element.toXML().toString());
|
||||
assertXMLEqual(xml, element.toXML(null).toString());
|
||||
|
||||
OriginIdElement parsed = OriginIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml));
|
||||
assertEquals(element.getId(), parsed.getId());
|
||||
|
|
|
@ -46,11 +46,11 @@ public class SpoilerTest extends SmackTestSuite {
|
|||
assertNull(empty.getHint());
|
||||
assertNull(empty.getLanguage());
|
||||
|
||||
assertXMLEqual(xml, empty.toXML().toString());
|
||||
assertXMLEqual(xml, empty.toXML(null).toString());
|
||||
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
||||
assertXMLEqual(xml, parsed.toXML().toString());
|
||||
assertXMLEqual(xml, parsed.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -65,12 +65,12 @@ public class SpoilerTest extends SmackTestSuite {
|
|||
assertEquals("Love story end", withHint.getHint());
|
||||
assertNull(withHint.getLanguage());
|
||||
|
||||
assertXMLEqual(xml, withHint.toXML().toString());
|
||||
assertXMLEqual(xml, withHint.toXML(null).toString());
|
||||
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
||||
|
||||
assertXMLEqual(xml, parsed.toXML().toString());
|
||||
assertXMLEqual(xml, parsed.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -85,13 +85,13 @@ public class SpoilerTest extends SmackTestSuite {
|
|||
assertEquals("Der Kuchen ist eine Lüge!", i18nHint.getHint());
|
||||
assertEquals("de", i18nHint.getLanguage());
|
||||
|
||||
assertXMLEqual(xml, i18nHint.toXML().toString());
|
||||
assertXMLEqual(xml, i18nHint.toXML(null).toString());
|
||||
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
||||
assertEquals(i18nHint.getLanguage(), parsed.getLanguage());
|
||||
|
||||
assertXMLEqual(xml, parsed.toXML().toString());
|
||||
assertXMLEqual(xml, parsed.toXML(null).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -211,19 +211,19 @@ public class MultipleRecipientManager {
|
|||
if (to != null) {
|
||||
for (Jid jid : to) {
|
||||
packet.setTo(jid);
|
||||
connection.sendStanza(new PacketCopy(packet.toXML()));
|
||||
connection.sendStanza(new PacketCopy(packet.toXML(null)));
|
||||
}
|
||||
}
|
||||
if (cc != null) {
|
||||
for (Jid jid : cc) {
|
||||
packet.setTo(jid);
|
||||
connection.sendStanza(new PacketCopy(packet.toXML()));
|
||||
connection.sendStanza(new PacketCopy(packet.toXML(null)));
|
||||
}
|
||||
}
|
||||
if (bcc != null) {
|
||||
for (Jid jid : bcc) {
|
||||
packet.setTo(jid);
|
||||
connection.sendStanza(new PacketCopy(packet.toXML()));
|
||||
connection.sendStanza(new PacketCopy(packet.toXML(null)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,13 +309,13 @@ public class MultipleRecipientManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toXML().toString();
|
||||
return toXML(null).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -118,12 +118,12 @@ public class MultipleAddresses implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder buf = new XmlStringBuilder(this);
|
||||
buf.rightAngleBracket();
|
||||
// Loop through all the addresses and append them to the string buffer
|
||||
for (Address address : addresses) {
|
||||
buf.append(address.toXML());
|
||||
buf.append(address.toXML(null));
|
||||
}
|
||||
buf.closeElement(this);
|
||||
return buf;
|
||||
|
@ -194,7 +194,7 @@ public class MultipleAddresses implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder buf = new XmlStringBuilder();
|
||||
buf.halfOpenElement(this).attribute("type", type);
|
||||
buf.optAttribute("jid", jid);
|
||||
|
|
|
@ -154,7 +154,7 @@ public class AMPExtension implements ExtensionElement {
|
|||
* Returns the XML representation of a XHTML extension according the specification.
|
||||
**/
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append('"');
|
||||
if (status != null) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class AttentionExtension implements ExtensionElement {
|
|||
* @see org.jivesoftware.smack.packet.PacketExtension#toXML()
|
||||
*/
|
||||
@Override
|
||||
public String toXML() {
|
||||
public String toXML(String enclosingNamespace) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append('<').append(getElementName()).append(" xmlns=\"").append(
|
||||
getNamespace()).append("\"/>");
|
||||
|
|
|
@ -46,7 +46,7 @@ public class BlockedErrorExtension implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.closeEmptyElement();
|
||||
return xml;
|
||||
|
|
|
@ -68,7 +68,7 @@ public class BoBExtension extends XHTMLExtension {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ public class DataPacketExtension implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = getIQChildElementBuilder(new IQChildElementXmlStringBuilder(this));
|
||||
xml.closeElement(this);
|
||||
return xml;
|
||||
|
|
|
@ -232,11 +232,11 @@ public class Bytestream extends IQ {
|
|||
xml.rightAngleBracket();
|
||||
if (getToActivate() == null) {
|
||||
for (StreamHost streamHost : getStreamHosts()) {
|
||||
xml.append(streamHost.toXML());
|
||||
xml.append(streamHost.toXML(null));
|
||||
}
|
||||
}
|
||||
else {
|
||||
xml.append(getToActivate().toXML());
|
||||
xml.append(getToActivate().toXML(null));
|
||||
}
|
||||
break;
|
||||
case result:
|
||||
|
@ -246,7 +246,7 @@ public class Bytestream extends IQ {
|
|||
// constructions mechanisms of Bytestream
|
||||
// A result from the server can also contain stream hosts
|
||||
for (StreamHost host : streamHosts) {
|
||||
xml.append(host.toXML());
|
||||
xml.append(host.toXML(null));
|
||||
}
|
||||
break;
|
||||
case get:
|
||||
|
@ -325,7 +325,7 @@ public class Bytestream extends IQ {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("jid", getJID());
|
||||
xml.attribute("host", getAddress());
|
||||
|
@ -375,7 +375,7 @@ public class Bytestream extends IQ {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("jid", getJID());
|
||||
xml.closeEmptyElement();
|
||||
|
@ -418,7 +418,7 @@ public class Bytestream extends IQ {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
xml.escape(getTarget());
|
||||
|
|
|
@ -132,7 +132,7 @@ public class SimpleDirectoryPersistentCache implements EntityCapsPersistentCache
|
|||
private static void writeInfoToFile(File file, DiscoverInfo info) throws IOException {
|
||||
DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
|
||||
try {
|
||||
dos.writeUTF(info.toXML().toString());
|
||||
dos.writeUTF(info.toXML(null).toString());
|
||||
} finally {
|
||||
dos.close();
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue