Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in reading XML data from Servlet

 
bablu singh
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am uploading XML file from JSP:

on submit action is getting called and going to servlet.
To read the content of the file I am using below code:

I am getting below output:

But I want only the xml portion. So that I can read the node contents.

Please help.
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Apache FileUpload to get just the file contents.
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
 
bablu singh
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestions...

But, it first uploads the file to a particular location like

and after that we can read the content of the file.

Is there any way, we can read the contents without uploading to a location.
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try HttpServletRequest.getPart()?

If using FileUpload, either use its streaming API (https://commons.apache.org/proper/commons-fileupload/streaming.html) or set the threshold of https://commons.apache.org/proper/commons-fileupload/apidocs/org/apache/commons/fileupload/disk/DiskFileItemFactory.html to a high value to prevent files being written to disk.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!