File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
REST with Spring (video course)
this week in the
Sockets and Internet Protocols
Writing xml data to file from TCP port
Joined: Sep 07, 2011
Sep 21, 2011 22:20:01
Currently my program code is listening to TCP port and I will be receiviing XML data and the data will be save to a file.
The issue is that the XML data contains the respond data from the server whenever it send back to the client, how can I get rid of the respond data.
if there are two responds... it will be
So I do not want to write the "respond=ok;blah blah" to the xml file. Because once I write that to a file, it will not be in a XML format. Please advice on how can I read the XML data from the TCP port correctly and save it to a file. Thanks.
Joined: Oct 27, 2005
Sep 22, 2011 02:01:19
Read parts of the data in advance (perhaps one line at a time), and only start writing once you've encountered the XML start.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
I agree. Here's the link:
subject: Writing xml data to file from TCP port
text files creation
XML over http
Correct Generated File Extensions from Action
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015