wood burning stoves 2.0*
The moose likes Servlets and the fly likes Read XML file in a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Read XML file in a servlet" Watch "Read XML file in a servlet" New topic
Author

Read XML file in a servlet

Muhammad Imad Qureshi
Ranch Hand

Joined: Sep 13, 2005
Posts: 238
Hi

I want to read xml file in a servlet as part of a HTTP post request. How do I do this. Am I going to use request.getInputStream() to read data or what. Is that possible to read the file as a file or may be separate elements.
Thanks
Imad
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8903

May be this will help
http://www.coderanch.com/t/361787/Servlets/java/HTTP-POST-body-gets-truncated

If it is part of body there is no need to create a file.


Groovy
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
You can pass this stream in InputSource of XML parser. It works like a charm.


Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Read XML file in a servlet
 
Similar Threads
Map object through servlet?
XML as servlet inputs
Security and threads about Xml in servlet
xm file as input for servlet
Updating a xml file inside a jar file