File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xm file as input for servlet

 
Ayub ali khan
Ranch Hand
Posts: 394
2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read from where , from client or from server itself?
 
Ayub ali khan
Ranch Hand
Posts: 394
2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 394
2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic