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 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:12 UTC