1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Use XmlStringBuilder in most toXML() bodies

Also change StringUtils.escapeForXML() and Packet.toXML() to return
CharSequence instead of String. XmlStringBuilder now has 'optX' methods.

Remove XmlUtils in favor of XmlStringBuilder
This commit is contained in:
Florian Schmaus 2014-03-21 09:51:52 +01:00
parent 1cf4681581
commit 978f692eb0
47 changed files with 511 additions and 412 deletions

View file

@ -786,9 +786,6 @@ public class AgentSession {
* @throws NotConnectedException
*/
public void setNote(String sessionID, String note) throws NoResponseException, XMPPErrorException, NotConnectedException {
note = ChatNotes.replace(note, "\n", "\\n");
note = StringUtils.escapeForXML(note);
ChatNotes notes = new ChatNotes();
notes.setType(IQ.Type.SET);
notes.setTo(workgroupJID);

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.workgroup.ext.notes;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.xmlpull.v1.XmlPullParser;
/**
@ -57,13 +58,13 @@ public class ChatNotes extends IQ {
}
public String getChildElementXML() {
StringBuilder buf = new StringBuilder();
XmlStringBuilder buf = new XmlStringBuilder();
buf.append("<").append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\">");
buf.append("<sessionID>").append(getSessionID()).append("</sessionID>");
if (getNotes() != null) {
buf.append("<notes>").append(getNotes()).append("</notes>");
buf.element("notes", getNotes());
}
buf.append("</").append(ELEMENT_NAME).append("> ");

View file

@ -374,13 +374,10 @@ public class Workgroup {
String name = iter.next();
String value = metadata.get(name).toString();
String escapedName = StringUtils.escapeForXML(name);
String escapedValue = StringUtils.escapeForXML(value);
FormField field = new FormField(escapedName);
FormField field = new FormField(name);
field.setType(FormField.TYPE_TEXT_SINGLE);
form.addField(field);
form.setAnswer(escapedName, escapedValue);
form.setAnswer(name, value);
}
joinQueue(form, userID);
}