Wednesday, September 28, 2011

Failure Parsing XML Document from Servlet

I'd like to pass an xml file to my gwt client. I created another
servlet that fetches it from the local file system and returns the xml
file when I call its url.

If I go to the url from my browser, it looks fine. If I fetch the url
from curl, it uses the >< kind of format. If I fetch the url
from my gwt client, I get different results and error messages in
development versus production mode.

If I archive the xml file directly into the war, my program works
perfectly.

I'm pretty sure it's not a GWT issue, but I'm not sure where else to
turn. Any guidance would be appreciated.

In development, it looks like I don't get a result at all and my error
is:
(XMLParserImplSafari.java:38) 2011-09-28 18:13:24,828 [FATAL] Uncaught
Exception:
com.google.gwt.xml.client.impl.DOMParseException: Failed to parse:
error on line 1 at column 1: Extra content at the end of the document
at
com.google.gwt.xml.client.impl.XMLParserImplSafari.throwDOMParseException(XMLParserImplSafari.java:
38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
167)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
326)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
207)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
132)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
at
com.google.gwt.xml.client.impl.XMLParserImplSafari.parseImpl(XMLParserImplSafari.java)
at
com.google.gwt.xml.client.impl.XMLParserImpl.parse(XMLParserImpl.java:
278)
at com.google.gwt.xml.client.XMLParser.parse(XMLParser.java:47)

In production, I get what looks like the right result back (based on
Log statements), and my error is:
com.google.gwt.xml.client.impl.DOMParseException: Failed to parse: <?
xml version="1.0" encoding="UTF-8"?><stuff>
<supertag>GriffinDashboard</supertag> <title>Publi
at
Unknown.java_lang_Throwable_fillInStackTrace__Ljava_lang_Throwable_2(Unknown
Source)
at
Unknown.com_google_gwt_xml_client_DOMException_DOMException__SLjava_lang_String_2V(Unknown
Source)
at
Unknown.com_google_gwt_xml_client_impl_DOMParseException_DOMParseException__Ljava_lang_String_2Ljava_lang_Throwable_2V(Unknown
Source)
at Unknown.com_google_gwt_xml_client_impl_XMLParserImpl_
$parse__Lcom_google_gwt_xml_client_impl_XMLParserImpl_2Ljava_lang_String_2Lcom_google_gwt_xml_client_Document_2(Unknown
Source)
at Unknown.com_atti_aas_griffin_dashboard_client_Config_
$parseChart__Lcom_atti_aas_griffin_dashboard_client_Config_2Ljava_lang_String_2V(Unknown
Source)
at
Unknown.com_atti_aas_griffin_dashboard_client_Config_Config__Ljava_lang_String_2V(Unknown
Source)
at Unknown.com_atti_aas_griffin_dashboard_client_GWTClient
$1_onResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V(Unknown
Source)
at Unknown.com_google_gwt_http_client_Request_
$fireOnResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_RequestCallback_2V(Unknown
Source)
at Unknown.com_google_gwt_http_client_RequestBuilder
$1_onReadyStateChange__Lcom_google_gwt_xhr_client_XMLHttpRequest_2V(Unknown
Source)
at Unknown.anonymous(Unknown Source)
at
Unknown.com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown
Source)
at
Unknown.com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown
Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)
Caused by: com.google.gwt.core.client.JavaScriptException: (Error):
XML Parsing Error: not well-formed

--
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-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