IntelliJ Java IDE
The moose likes I/O and Streams and the fly likes String to File? Del. one line in a file? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Reply Bookmark "String to File? Del. one line in a file?" Watch "String to File? Del. one line in a file?" New topic
Author

String to File? Del. one line in a file?

Roy Huang
Ranch Hand

Joined: Nov 21, 2001
Posts: 104
Hi,I have a xml file, which I want to add two lines and delete one line of it.
For the adding lines, I will use stringbuffer and append method to add it as a whole string, but how can I change it back to a temp File for transferring?
and How can I delete one line in my XML files?
it will be start with "<?"`end with "?>"
Thanks for any suggestins and help!!
Roy


SCJP 1.4/SCBCD/SCWCD<br />MCSE<br />IBM professional XML Developer<br />SAP certified Development Consultant (NetWeaver portal and Web JavaApplication)
Maciej Kolodziej
Greenhorn

Joined: Feb 11, 2002
Posts: 26
If You want to manipulate existing file content You can check java.io.RandomAccessFile.
But for manipulating xml file content You should user dom parser, which recreates xml as a tree and lets You change it and than write to a file.


MK
 
jQuery in Action, 2nd edition
 
subject: String to File? Del. one line in a file?
 
Threads others viewed
Incompatible type issue
reading a file by lines
How to update and delete records in a text file?
Need help writing star pattern to file
reading a file by lines
IntelliJ Java IDE