• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Roy Huang
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Maciej Kolodziej
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!