On Thursday, September 29, 2011 10:39:40 PM UTC+2, Laura Bickle wrote:
Hi Jeff,
I set the content type like so: response.setContentType("text/xml");
I think MIME is a superset of content type. I don't explicitly set any other MIME things. How do I look up the MIME type of a file?
My previous errors are from firefox. Per your suggestion, I tried using safari and chrome instead and they each gave me this error. The first line is the result of requesting the xml file. The second line comes from trying to parse it.
(-:-) 2011-09-29 13:32:28,825 [DEBUG] result:<?xml version="1.0" encoding="UTF-8"?><stuff>
IIRC, some browsers (can't remember which ones) choke on the XMLDecl when it specifies an encoding; because you're parsing a String, which is a stream of characters, and encodings only applies to streams of bytes (to actually turn the bytes into characters).
Try trimming the XMLDecl from your XML before giving it to XMLParser.parse().
Something like (untested):
if (xml.substring(0, 5).equalsIgnoreCase("<?xml")) {
xml = xml.substring(xml.indexOf("?>") + 2);
}
Best would of course be to emit the encoding in the Content-Type HTTP header (application/xml; charset=UTF-8) and not send the XMLDecl at all.
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/1h74ivOd75AJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment