• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

xm file as input for servlet

 
Ranch Hand
Posts: 399
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read from where , from client or from server itself?
 
Ayub ali khan
Ranch Hand
Posts: 399
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 399
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic