Hello!
I have a class that reads a xml file. Sometimes the document that I
read, it has the following format:
<root>
<a>
</root>
sometimes the document has the following form:
<root>[]<a>[]</root>
That is, sometimes the newline is coded with a only bytes, and sometimes
with two bytes.
The problem is that I would like to parse the document and then re-write
it in the same wave that I read it.
However, with the way that I'm using the result is always as the second
form.
The code is:
DOMParser parser = new DOMParser();
parser.parse("A.xml");
DocumentImpl document = (DocumentImpl)parser.getDocument();
//do some treatment...
....
OutputFormat formato = new OutputFormat(document);
XMLSerializer ser = new XMLSerializer(sw, formato);
ser.serialize(document);
System.out.println(sw.toString());
FileOutputStream fout=new FileOutputStream("B.xml");
fout.write(sw.toString().getBytes());
fout.close();
Could you help me to solve my problem?
Regards,
Antonio.
--
------------------------------------------------------
Antonio Ruiz Martínez
Faculty of Computer Science-University of Murcia
30071 Murcia - Spain
e-mail: [EMAIL PROTECTED] or arm [at] dif [dot] um [dot] es
------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]