Cita: Mensaje Original por soniagrande
Prueba esto a ver si te sirve
try{
String str = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n<tlf>+584123161640</tlf>\n<op>Digitel</op>\n<sc>3344</sc>\n<body>Prueba de mensaje</body>\n</root>";
str = str.replaceAll("\n","\r\n");
FileOutputStream fos = new FileOutputStream("fichero.txt");
PrintStream ps = new PrintStream(fos);
ps.println(str);
ps.close();
}
catch(Exception ex){
}
El mismo problema exacto, NO reconoce los "\n" en el string por alguna causa que desconozco y por ende NO realiza la sustitucion, de cualquier manera gracias por intentarlo.