| | |
saving xml file from servlet request instance
![]() |
•
•
Join Date: Jul 2005
Posts: 2
Reputation:
Solved Threads: 0
Hello,
My first post, a little nervous I am. I am starting with learning Java on the server side in servlets. I use Flash on the client side. What I would like to do is the following:
How can I retrieve the xml file from the servlet request instance and save it. I will do the xml creation and evaluation on the client. So retrieving xml from the servlet request instance and saving the xml data is all I want to do for now(to little experience yet on java...but for now I need this save mechanism to work).
Problem is two ways: 1) retrieving xml data 2) saving data
On 1) I do not have a clue
On 2) maybe use construction with: String xml = xml_data_as_a_string; File f = new File("c\xmlData");FileWriter fw = new FileWriter(f);fw.write(xml);
Thanks for any help
My first post, a little nervous I am. I am starting with learning Java on the server side in servlets. I use Flash on the client side. What I would like to do is the following:
client side: send xml file / receive xml fileTo achieve this I use the client code (Flash snippet):
server: accept xml file and save it / sent xml file when requested.
Java Syntax (Toggle Plain Text)
my_xml = new XML("<tag1><tag2 /></tag1>"); my_xml.contentType = "text/xml"; my_xml.send("saveXML.jsp");
How can I retrieve the xml file from the servlet request instance and save it. I will do the xml creation and evaluation on the client. So retrieving xml from the servlet request instance and saving the xml data is all I want to do for now(to little experience yet on java...but for now I need this save mechanism to work).
Problem is two ways: 1) retrieving xml data 2) saving data
On 1) I do not have a clue
On 2) maybe use construction with: String xml = xml_data_as_a_string; File f = new File("c\xmlData");FileWriter fw = new FileWriter(f);fw.write(xml);
Thanks for any help
1) see the servlet API. You're likely looking at retrieving a large stream of data as part of a post request.
2) think about using the built-in XML support of the Java core API, or else to use a 3rd party XML parser like Xerces.
2) think about using the built-in XML support of the Java core API, or else to use a 3rd party XML parser like Xerces.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
•
•
Join Date: Jul 2005
Posts: 2
Reputation:
Solved Threads: 0
...(I still will have to find out the exact programming code.... but this is about the approach)....
Ok let's see ...would the following then work? Basic idea....use buffered reader via:
This retrieves the body of the request as character data using a BufferedReader.
Since only the body and no header info is in the "bin" , only xml data is there. Now by retrieving each line via bin.readline() and saving it into a standard file by using a FileWriter I can save the xml data?
Is this corect thinking?? If so, is this an efficient way to do it(no better way maybe)
Thank you
Ok let's see ...would the following then work? Basic idea....use buffered reader via:
•
•
•
•
BufferedReader bin = request.getReader()
Since only the body and no header info is in the "bin" , only xml data is there. Now by retrieving each line via bin.readline() and saving it into a standard file by using a FileWriter I can save the xml data?
Is this corect thinking?? If so, is this an efficient way to do it(no better way maybe)
Thank you
![]() |
Similar Threads
- [urgent] HTML form => XML file (JSP)
- Multiple Table Reading From An Xml File (VB.NET)
- Ignoring xmlns namespaces in the input xml file (XML, XSLT and XPATH)
- append to XML file (Visual Basic 4 / 5 / 6)
- problem reading xml file in c# (C#)
- parsing error (XML file-java-schema) (Java)
- Pass XML file contents to a hash table. (Java)
Other Threads in the Java Forum
- Previous Thread: Logical Operator help
- Next Thread: about CVS protocol and CVS client
| Thread Tools | Search this Thread |
6 actuate android api applet application applications array arrays automation balls bank binary bluetooth bold business c++ chat class clear client code codesnippet collections component coordinates database defaultmethod development dice doctype dragging ebook eclipse educational error file formatingtextintooltipjava fractal froglogic game givemetehcodez graphics gui hql html ide ideas image infinite ingres input integer intersect invokingapacheantprogrammatically j2me java javaprojects jni jpanel jtextarea julia linux list map method methods mobile mysql netbeans nextline openjavafx parameter php problem program project recursion recursive repositories scanner scrollbar server set sms sort sorting sql sqlserver state storm string sun superclass swing swt threads tree websites windows






