W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2004

RE: DOM 3 LS - LSSerializer.writeToString encoding declaration

From: Curt Arnold <carnold@houston.rr.com>
Date: Thu, 22 Jan 2004 19:08:56 -0600
Message-Id: <B80DF894-4D40-11D8-A2AB-000393B97126@houston.rr.com>
To: www-dom@w3.org

A definitive resolution would need to come from the working group.

My take on it is that serializer.writeToString(nodeArg) should be 
equivalent to:

LSOutput output = domImplLS.createLSOutput();
output.characterStream = new StringWriter();
serializer.write(nodeArg, output);

And that that should be equivalent to:

LSOutput output = domImplLS.createLSOutput();
output.byteStream = new ByteArrayOutputStream();
serializer.write(nodeArg, output);
And then reading the byteStream with an InputStreamReader with the 
appropriate encoding.


If these equivalences were followed then Document.inputEncoding or 
Document.xmlEncoding would control the encoding declaration.  So if the 
source document had <?xml encoding="US-ASCII"?> then the string from 
writeToString would contain "<?xml encoding="US-ASCII"?>" and all 
non-US-ASCII characters would be represented by character entities.
Received on Thursday, 22 January 2004 20:09:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:57 GMT