[android-developers] Creating xml with image from DB
Hi,
I want to upload an image from my db to a server. But this image had
to be in a xml.
The xml format is:
<REC>
<F1>id</F1>
<F2>description</F2>
<F3><![CDATA[image_byte_array]]></F3>
<F4>date</F4>
</REC>
I'm building the XML with XmlSerializer:
XmlSerializer serializer = Xml.newSerializer();
ByteArrayOutputStream bout = new ByteArrayOutputStream();
serializer.setOutput(new ObjectOutputStream(bout),
HTTP.ISO_8859_1);
serializer.startTag("", "REC");
[...]
String testString = EncodingUtils.getString(c.getBlob(colIdx),
HTTP.ISO_8859_1);
serializer.cdsect(testString);// Doesn't work ->
IllegalArgumentExeption Illegal Caracter (0)
bout.write(new byte[]{'<', '!', '[', 'C', 'D', 'A', 'T', 'A',
'['});
bout.write(c.getBlob(colIdx));
bout.write(new byte[]{']', ']', '>'}); // work but mtXml is only
this and not the rest of the xml
break;
[...]
serializer.endTag("", "REC");
serializer.endDocument();
mtXml = bout.toString();
In the blackberry version of the application, all the xml is build in
an outputstream. Does I need to do the same or is it possible to do it
with the XmlSerializer?
Thanks,
Sebastien
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home