Dick Deneer <[EMAIL PROTECTED]> wrote on 02/13/2006 
02:22:37 AM:

> Michael,
> 
> I have some extra for  suggestions/questions about the DomSerializer:
> 
> 1. When I specify the the encoding on the LSOutput, the encoding is 
> used (or substituted) in the XML declaration, and it is also used as 
> file encoding. Sometimes (to be compatible with other programs) you 
> want to leave the XML declaration unchanged but only use the encoding 
> as file encoding. I know it is not recommended to have these two out of 
> sync, but for some situations it is needed. Is this possible?

It's not supported by the spec. DOM Level 3 Load and Save [1] says: "In 
all cases, the encoding declaration, if generated, will correspond to the 
encoding used during the serialization (e.g. encoding="UTF-16" will appear 
if UTF-16 was requested)". I suppose you could set a Writer (for the 
output encoding you want) on the LSOutput instead of setting the encoding. 
However if you do that, characters which can be represented in the 
encoding specified in the XML declaration but not in the output encoding 
will not be correctly written as character references.

> 2. When not using pretty-print, is it possible to leave out all 
whiteSpace?

You could try filtering it out using an LSSerializerFilter [2].

> Regards,
> Dick Deneer

[1] 
http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html#LS-LSSerializer
[2] 
http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html#LS-LSSerializerFilter

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to