Hi,
I have one problem; I must read a html like this;
<html>
<body>
Hello
</body>
</html>
<html>
<body>
Hello
</body>
</html>
To copy to clipboard, switch view to plain text mode
I read this in a string (correct?) and after I have to do some changes to it and write it on disk but in this way:
<html>\n<body> ........
<html>\n<body> ........
To copy to clipboard, switch view to plain text mode
There, there's the '\n' because in the original file <body> was in another line of <html>
How can I do this? This my code for read and write:
File fin = new File(FILE_NAME);
FileReader in = new FileReader(fin);
istream = new BufferedReader( in );
String line = null;
while ( (line = istream.readLine()) != null ) {
//System.out.println(line);
sb.append(line);
}
// here do changes on the sb
String text = sb.toString();
FileWriter fw = new FileWriter(new File ("out.txt") );
out = new PrintWriter(fw);
out.println(text);
File fin = new File(FILE_NAME);
FileReader in = new FileReader(fin);
istream = new BufferedReader( in );
String line = null;
while ( (line = istream.readLine()) != null ) {
//System.out.println(line);
sb.append(line);
}
// here do changes on the sb
String text = sb.toString();
FileWriter fw = new FileWriter(new File ("out.txt") );
out = new PrintWriter(fw);
out.println(text);
To copy to clipboard, switch view to plain text mode
Thanks,
Bookmarks