简体   繁体   中英

Retrieving XML results of a POST command

As part of my GWT application I have a POST method that accepts a file (so I need to use form submission) and returns an updated list of elements as xml. I use the GWT formPanel to do this. The formpanel redirects the results of the post into a separate iframe. Using the dom inspector I can see that the results are actually there. Unfortunately GWT retrieves the results with iframe.contentWindow.document.body.innerHTML . As my results are sent back using content type text/xml, the xml parser of the browser is used, and obviously html DOM does not apply. I'm stuck now to get to know the correct javascript to get the xml contents.

The solution was actually easy. Just return iframe.contentWindow.document and parse the result. Of course that "Document" is a com.google.gwt.dom.client.Document and not a com.google.gwt.xml.client.Document . Also, as the frame handle is not visible for children, the whole FormPanel class needs to be reimplemented (copied).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM