06-28-2010 10:48 AM
I'd like to parse incoming emails on the device to extract some information. The format of the email is XHTML and I use a sax parser to extract the data (API version 4.2.1).
InputStream is = new ByteArrayInputStream(xhtml.getBytes(encoding)); _document = docBuilder.parse(is);
It works quite well but it seems there's a size limit on byte arrays (max count = 1999) because I got a "unexpected end of file exception" when my string is too long.
Does anyone know how to overcome this size limit?
Solved! Go to Solution.
06-28-2010 12:45 PM
There's no such limit on byte array lengths. What's coming back from xhtml.getBytes(encoding)? Even without knowing what class of object xhtml is, my guess is that that's truncated somehow. (If it's a String, perhaps it doesn't have all the XHTML in it. Have you checked this?)
06-28-2010 01:35 PM
By default, I think just the first 2K worth of data associated with an email is delivered to the device. You need to ask for more to get the rest I believe. Could that be the problem? Have a look in the KnowledgeBase for articles about this, I do seem to remember seeing one that addressed this and described how to get the remaining data.
06-29-2010 03:22 AM
That's right, I forgot this 2k limit for the email body!
Anyway, I'm supposed to read the content from the HTML file attached to the email but since the simulators do not support attachments I stored the HTML in the email body.
Thanks to both of you for your help.