A technique I've used--though it requires two trips to the server--is
for the form processing servlet to create a temporary file of the XML
and store it in a session attribute.  Let the servlet return "ok" or
some such short notice (write the exception if the servlet errors;
this gives you something to test).  In the form's
addSubmitCompleteHandler, check the getResult() from the
FormPanel.SubmitCompleteEvent.  If it's "ok" (or starts with "ok"),
make an RPC service call that recovers the temporary file, reads its
contents to a string, deletes the temporary file, and returns the
string.

On Jul 8, 12:53 pm, Robert Hanson <iamroberthan...@gmail.com> wrote:
> Based on the docs for FormPanel the server has to reply with the
> content-type of text/html, otherwise there may be issues with some
> browsers.  But if you do that, and send XML content it seems it has browser
> issues.
>
> For example, in FF/DevMode the SubmitCompleteEventHandler returns null for
> the result.  In Chrome is returns the XML content, but it is malformed.
> Some elements like <link /> were in the results as <link>, causing XML
> parsing issues.
>
> One solution I found was to return the XML as an HTML comment, prefixed by
> some fake content.
>
> For example, instead of this:
> <?xml version='1.0' encoding='UTF-8'?><feed>...</feed>
>
> I returned this:
> content<!--<?xml version='1.0' encoding='UTF-8'?><feed>...</feed>-->
>
> I can then remove the prefix "content<!--" and postfix "-->" text, and parse
> what remains as XML.
>
> Other than the fact that I don't handle the possibility of comments within
> the XML content, is there any other potential issues?  Or maybe there is a
> better way?
>
> The only requirement for what I am working on is that it must use a
> FormPanel submission, and parse the XML returned from the server.
>
> Thanks.
>
> Rob

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to