aspose file tools*
The moose likes Servlets and the fly likes xm file as input for servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "xm file as input for servlet" Watch "xm file as input for servlet" New topic
Author

xm file as input for servlet

Ayub ali khan
Ranch Hand

Joined: Oct 20, 2005
Posts: 383
    
    2
Hi,

How can I read a simple xml file using a servlet? Mean while I do some google search if I can find some hints..


Best Regards
Ayub


SCEA part I,TOGAF Foundation
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Read from where , from client or from server itself?


Rahul Bhattacharjee
LinkedIn - Blog
Ayub ali khan
Ranch Hand

Joined: Oct 20, 2005
Posts: 383
    
    2
Hi Rahul,

XM file needs to be read from the client as an input stream. I need to genereate back an xml document. I am not sure what processing needs to be done. If I know how to read xml and generate the same xml back, I am good with it. Any useful links on this can be useful.

Thank you.

Best Regards
Ayub.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
We are using XStream, DomDriver from thoughtworks xstream, a Java library to serialize/deserialize objects to/from XML.

You can find that here
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Still I do not know about the client you are taking about.
If that is browser , you can use

<input type="file" name="fileName"/>

and at the server you can use fileUploader.
http://faq.javaranch.com/view?FileUpload
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
How about working through the Sun tutorial on XML processing.

Creating a Document object from any InputStream is pretty simple, here is an example:

Ayub ali khan
Ranch Hand

Joined: Oct 20, 2005
Posts: 383
    
    2
Hi William,

Thanks for a cool code and the link !! While I was searching for info on XML I cam across the JDOM parser. I need some inputs on this, will post the query in the XML forum.

Thanks for your wonderful answer!!

Best Regards
Ayub.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xm file as input for servlet