Hi Thomas, Thanks for your suggestions, I've used the xmp tag and the DIV trick and it now works a treat!
Thanks for your help -Stu On Jul 21, 3:07 pm, Thomas Broyer <[email protected]> wrote: > On 21 juil, 15:47, Stuart_L <[email protected]> wrote: > > > > > Hi Manolo, > > > Actually I think the problem may be due to the HTML form response > > rather than the XML parser. > > > Our system works by using a FormPanel with a FileUpload object to > > upload a zip file to a servlet. The servlet then processes this and > > creates an XML file detailing the zip file contents. The FormHandler - > > onSubmitComplete(FormSubmitCompleteEvent event) listener receives the > > XML string response from the servlet. > > However the problem is the FormSubmitCompleteEvent will only accept > > content that is of MIME type text/html - it returns null if you try to > > send back text/xml or application/xml. > > > So I think that as it is text/html being returned by the servlet it is > > all being converted to lowercase as html is case-insensitive. > > Right, if you just send XML labeled as being text/html, it'll be > parsed as HTML and then the FormPanel will re-serialize it with the > help of the "innerHTML" property. > > > Does anyone have any other way to submit a zip file to a servlet and > > return an XML string? > > You can try two things (amongst probably many others): > - prefix your XML with "<plaintext>" or wrap it within <xmp> (they > are roughly equivalent to <![CDATA[]]> in the text/html world) and of > course account for it when parsing with XMLParser > - HTML-escape your XML (i.e. < instead of "<" and & instead of > "&") before sending it to the browser, that way it won't be parsed as > HTML markup, but you'll have to un-escape it on the client side; to > unescape, in your GWT code, you can create a dummy DIV element, set > the form's result with setInnerHTML and get it back with getInnerText > (or just do string replacements of & and <, but in my opinion > the setInnerHTML/getInnerText is more robust re. non-Windows-1252 > characters, which the browser might convert into character references > when serializing using innerHTML) > > ...of course, it's far easier to just not use square brackets and > ampersands in your response... (e.g. JSON with \uXXXX-escaped "<" and > "&"), and do not count too much on whitespace being preserved too. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
