Hi,

You should have the following :
/MyModule.gwt.xml
/public/config.xml

Then, you can access file with the URL : GWT.getModuleBaseURL() +
"config.xml"

An other way to load content is to use a TextResource with ClientBundle (
see
http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#TextResource)

Alexandre


2011/8/30 AThinerCoin <[email protected]>

> I'd like to access a static file, let's say config.xml from my onModuleLoad
> method.
>
> It says on this webpage, that config.xml should live in the public sibling
> dir of my .gwt.xml file, but I've tried that and onModuleLoad function still
> gives me the error below.
>
> It also suggests that I add a line to the .gwt.xml file like   <public
> path='public'/>  but that isn't working for me either.
>
>
> http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html
>
> I've tried searching for an example, but I don't see one.
>
> com.google.gwt.xml.client.impl.DOMParseException: Failed to parse: error on
> line 1 at column 1: Document is empty
>
>     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)
>     at com.java2s.gwt.client.client.GWTClient.loadConfig(GWTClient.java:56)
>     at
> com.java2s.gwt.client.client.GWTClient.onModuleLoad(GWTClient.java:46)
>     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.ModuleSpace.onLoad(ModuleSpace.java:396)
>     at
> com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:193)
>     at
> com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
>     at
> com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
>     at java.lang.Thread.run(Thread.java:680)
>
> Thank you for your help!
>
> --
> 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/-/hn3FEy1zmZAJ.
> 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.
>

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

Reply via email to