You simply can't directly read an xml file located at the client-side filesystem without uploading it first to your server.
So the steps to read - deserialize xml, when that xml is in the filesystem of the client is: 1. upload file to server. Using a normal java servlet for example (or with your preferred method if you have another one) 2. Once the xml is in your server, you deserialize it with your framework of choice (xstream for example) 3. Once you have populated objects with the values from the xml, you can notify the client (in the reponse from your upload servlet for instance) 4. The client is notified and calls the server to retrieve the deserialized object. It's a little more convoluted than just making a RPC but any java developer worth its salt should be able to do it. For a FileUploadServlet example take a look at: The servlet code: http://code.google.com/p/hellagwt/source/browse/trunk/hellagwt/src/main/java/fr/salvadordiaz/gwt/hellagwt/server/NzbUpload.java The client code: http://code.google.com/p/hellagwt/source/browse/trunk/hellagwt/src/main/java/fr/salvadordiaz/gwt/hellagwt/client/views/UploadPanel.java That should help, if it doesn't I don't know what could Salvador On 14 mai, 14:01, Rohit Vadera <[email protected]> wrote: > I would be giving the try to XStream. > > But before that > > http://code.google.com/webtoolkit/doc/1.6/DevGuideCodingBasics.html#D... > > The example given by google in above link never tells how we have to > read the xml from file system becasue as I know java.io is again not > supported. > > Once read then only i can convert it into String. > > Anybody clues please!!! > > On May 14, 4:27 pm, Salvador Diaz <[email protected]> wrote: > > > Hi, > > > > But would it be fast enough compared to RPC ? > > > AFAIK, speed will wildly vary between browsers. IMHO you're better off > > parsing the xml server-side and returning a java object to your > > client. plus you get to use awesome frameworks like > > XStream:http://xstream.codehaus.org/ > > > In our GWT applications we make heavy use of REST calls that return > > xml. That xml is then parsed with xstream and it can be as simple as: > > > XStream xstream = new XStream(); > > MyObject object = (MyObject)xstream.fromXML(myXmlRestResponse); > > > Hope that helps, > > > Salvador > > > On 14 mai, 13:11, Rohit Vadera <[email protected]> wrote: > > > > Ok i gottcha. > > > > But would it be fast enough compared to RPC which will use SAX for > > > parsing and then returning the data structure of values in collection. > > > Does it really depends on XML size to choose between GWT API or SAX on > > > server?? > > > > Thoughts!!!!! > > > > On May 14, 3:33 pm, Paul Robinson <[email protected]> wrote: > > > > >http://code.google.com/webtoolkit/doc/1.6/DevGuideCodingBasics.html#D... > > > > > abhiram wuntakal wrote: > > > > > I dont think so u can do any such operations on the client side. You > > > > > can rather use the file upload widget, transfer the code to the sever > > > > > side and make use of simple File Read opeartions to read the contents > > > > > of the XML file. Then you can bring back this data and display it on > > > > > the client side. > > > > > > hope this helps. > > > > > > regards, > > > > > Abhiram > > > > > > On Thu, May 14, 2009 at 3:50 PM, Pints <[email protected] > > > > > <mailto:[email protected]>> wrote: > > > > > > Hi, > > > > > > Can any share the ideas that how can i read XML on client in GWT? > > > > > > thanks,- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text - > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
