doctorAle85
07-11-2009, 10:15
Ciao a tutti,
ho un grande problema...magari sarà una cavolata, ma sto impazzendo!:muro:
ho questo metodo...
public void serialize(String file) throws IOException {
FileWriter fw;
fw=new FileWriter(file);
BufferedWriter bw;
bw=new BufferedWriter (fw);
OutputFormat format = new OutputFormat("XML",null,true);
format.setIndent(1);
format.setIndenting(true);
format.setDoctype(null,"DTD/example.dtd");
ser = new XMLSerializer(format);
ser.setOutputCharStream(bw);
ser.setOutputByteStream(System.out);
ser.serialize(document);
bw.flush();
bw.close();
}
...il problema è che ser.setOutputByteStream(System.out) mi stampa nella console il risultato esatto XML che dovrebbe mettermi nel file.
ser.setOutputCharStream(bw) invece non scrive su file!...cioè, mi crea il file ma è vuoto!!!
ho un grande problema...magari sarà una cavolata, ma sto impazzendo!:muro:
ho questo metodo...
public void serialize(String file) throws IOException {
FileWriter fw;
fw=new FileWriter(file);
BufferedWriter bw;
bw=new BufferedWriter (fw);
OutputFormat format = new OutputFormat("XML",null,true);
format.setIndent(1);
format.setIndenting(true);
format.setDoctype(null,"DTD/example.dtd");
ser = new XMLSerializer(format);
ser.setOutputCharStream(bw);
ser.setOutputByteStream(System.out);
ser.serialize(document);
bw.flush();
bw.close();
}
...il problema è che ser.setOutputByteStream(System.out) mi stampa nella console il risultato esatto XML che dovrebbe mettermi nel file.
ser.setOutputCharStream(bw) invece non scrive su file!...cioè, mi crea il file ma è vuoto!!!