mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 18:29:45 +02:00
Introduce and use XmlStringBuilder.text()
Smack currently does unnecessary escaping of XML text, where it escapes e.g. '"' to '"'. This bloats the stanza size, especially if JSON payloads are involved. Fixes SMACK-892 (although there are probably still places where XmlStringBuilder.escape() is used when XmlStringBuild.text() could have been used).
This commit is contained in:
parent
9e9d30074c
commit
b7824f008d
6 changed files with 29 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright © 2014 Florian Schmaus
|
||||
* Copyright © 2014-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -35,7 +35,7 @@ public abstract class AbstractJsonPacketExtension implements ExtensionElement {
|
|||
public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.rightAngleBracket();
|
||||
xml.append(json);
|
||||
xml.text(json);
|
||||
xml.closeElement(this);
|
||||
return xml;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
public class MarkableExtensionTest {
|
||||
|
||||
String markableMessageStanza = "<message xmlns='jabber:client' to='ingrichard@royalty.england.lit/throne' id='message-1'>"
|
||||
+ "<body>My lord, dispatch; read o'er these articles.</body>"
|
||||
+ "<body>My lord, dispatch; read o'er these articles.</body>"
|
||||
+ "<markable xmlns='urn:xmpp:chat-markers:0'/>" + "</message>";
|
||||
|
||||
String markableExtension = "<markable xmlns='urn:xmpp:chat-markers:0'/>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue