Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0050c98 authored by Hemant Gupta's avatar Hemant Gupta Committed by Android Git Automerger
Browse files

am 63260439: MAP: Modify XML serializer to escape double quote

* commit '63260439':
  MAP: Modify XML serializer to escape double quote
parents 823111f5 63260439
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.android.internal.util.FastXmlSerializer;

import org.xmlpull.v1.XmlSerializer;

@@ -74,17 +75,18 @@ public class BluetoothMapMessageListing {
     */
    public byte[] encode() throws UnsupportedEncodingException {
        StringWriter sw = new StringWriter();
        XmlSerializer xmlMsgElement = Xml.newSerializer();
        XmlSerializer xmlMsgElement = new FastXmlSerializer();
        try {
            xmlMsgElement.setOutput(sw);
            xmlMsgElement.startDocument(null, null);
            xmlMsgElement.startTag("", "MAP-msg-listing");
            xmlMsgElement.attribute("", "version", "1.0");
            xmlMsgElement.startDocument("UTF-8", true);
            xmlMsgElement.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
            xmlMsgElement.startTag(null, "MAP-msg-listing");
            xmlMsgElement.attribute(null, "version", "1.0");
            // Do the XML encoding of list
            for (BluetoothMapMessageListingElement element : list) {
                element.encode(xmlMsgElement); // Append the list element
            }
            xmlMsgElement.endTag("", "MAP-msg-listing");
            xmlMsgElement.endTag(null, "MAP-msg-listing");
            xmlMsgElement.endDocument();
        } catch (IllegalArgumentException e) {
            Log.w(TAG, e.toString());
+19 −19
Original line number Diff line number Diff line
@@ -220,41 +220,41 @@ public class BluetoothMapMessageListingElement
    {

            // contruct the XML tag for a single msg in the msglisting
            xmlMsgElement.startTag("", "msg");
            xmlMsgElement.attribute("", "handle", mapHandle);
            xmlMsgElement.startTag(null, "msg");
            xmlMsgElement.attribute(null, "handle", mapHandle);
            if(subject != null)
                xmlMsgElement.attribute("", "subject", subject);
                xmlMsgElement.attribute(null, "subject", subject);
            if(dateTime != 0)
                xmlMsgElement.attribute("", "datetime", this.getDateTimeString());
                xmlMsgElement.attribute(null, "datetime", this.getDateTimeString());
            if(senderName != null)
                xmlMsgElement.attribute("", "sender_name", senderName);
                xmlMsgElement.attribute(null, "sender_name", senderName);
            if(senderAddressing != null)
                xmlMsgElement.attribute("", "sender_addressing", senderAddressing);
                xmlMsgElement.attribute(null, "sender_addressing", senderAddressing);
            if(replytoAddressing != null)
                xmlMsgElement.attribute("", "replyto_addressing",replytoAddressing);
                xmlMsgElement.attribute(null, "replyto_addressing",replytoAddressing);
            if(recipientName != null)
                xmlMsgElement.attribute("", "recipient_name",recipientName);
                xmlMsgElement.attribute(null, "recipient_name",recipientName);
            if(recipientAddressing != null)
                xmlMsgElement.attribute("", "recipient_addressing", recipientAddressing);
                xmlMsgElement.attribute(null, "recipient_addressing", recipientAddressing);
            if(type != null)
                xmlMsgElement.attribute("", "type", type.name());
                xmlMsgElement.attribute(null, "type", type.name());
            if(size != -1)
                xmlMsgElement.attribute("", "size", Integer.toString(size));
                xmlMsgElement.attribute(null, "size", Integer.toString(size));
            if(text != null)
                xmlMsgElement.attribute("", "text", text);
                xmlMsgElement.attribute(null, "text", text);
            if(receptionStatus != null)
                xmlMsgElement.attribute("", "reception_status", receptionStatus);
                xmlMsgElement.attribute(null, "reception_status", receptionStatus);
            if(attachmentSize != -1)
                xmlMsgElement.attribute("", "attachment_size", Integer.toString(attachmentSize));
                xmlMsgElement.attribute(null, "attachment_size", Integer.toString(attachmentSize));
            if(priority != null)
                xmlMsgElement.attribute("", "priority", priority);
                xmlMsgElement.attribute(null, "priority", priority);
            if(read != null && reportRead)
                xmlMsgElement.attribute("", "read", read);
                xmlMsgElement.attribute(null, "read", read);
            if(sent != null)
                xmlMsgElement.attribute("", "sent", sent);
                xmlMsgElement.attribute(null, "sent", sent);
            if(protect != null)
                xmlMsgElement.attribute("", "protected", protect);
            xmlMsgElement.endTag("", "msg");
                xmlMsgElement.attribute(null, "protected", protect);
            xmlMsgElement.endTag(null, "msg");

    }
}