mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 09:39:39 +02:00
Make XHTMLText use XmlStringBuidler
also define all element and attribute names as constants.
This commit is contained in:
parent
8526f8ab29
commit
d8d88d9abd
6 changed files with 185 additions and 206 deletions
|
@ -47,6 +47,8 @@ import java.util.*;
|
|||
*/
|
||||
public class Message extends Packet {
|
||||
|
||||
public static final String BODY = "body";
|
||||
|
||||
private Type type = Type.normal;
|
||||
private String thread = null;
|
||||
private String language;
|
||||
|
@ -440,9 +442,9 @@ public class Message extends Packet {
|
|||
// Skip the default language
|
||||
if(body.equals(defaultBody))
|
||||
continue;
|
||||
buf.halfOpenElement("body").xmllangAttribute(body.getLanguage()).rightAngelBracket();
|
||||
buf.halfOpenElement(BODY).xmllangAttribute(body.getLanguage()).rightAngelBracket();
|
||||
buf.escape(body.getMessage());
|
||||
buf.closeElement("body");
|
||||
buf.closeElement(BODY);
|
||||
}
|
||||
buf.optElement("thread", thread);
|
||||
// Append the error subpacket if the message type is an error.
|
||||
|
|
|
@ -185,7 +185,7 @@ public class PacketParserUtils {
|
|||
message.addSubject(xmlLang, subject);
|
||||
}
|
||||
}
|
||||
else if (elementName.equals("body")) {
|
||||
else if (elementName.equals(Message.BODY)) {
|
||||
String xmlLang = getLanguageAttribute(parser);
|
||||
if (xmlLang == null) {
|
||||
xmlLang = defaultLanguage;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue