At 8:50 PM -0700 5/1/05, Daniel L. Rall wrote:

Ignoring the encoding="..." XML header, that would indeed be valid XML. However, when the XML is subsequently processed, the entity-encoded value will transformed into ASCII. Since there is no equivalent 7 bit ASCII character which fits within that range (e.g. 0x7f is ASCII 127), a parse error will be generated.

I believe it is incorrect for XMLWriter to make any assumptions about encodings, especially since the encoding is passed in the constructor. If I create an instance of XMLWriter that I expect to support a binary encoding that I passed in the constructor, I shouldn't have to worry about an encoding related error later on. Encoding related errors should probably happen at the time I specify an encoding.


If this is truly the behavior you wish to enforce, and I see no reason for it, perhaps the Constructor should throw an UnsupportedEncodingException if the encoding is neither UTF-8 nor UTF-16.
--


Steve

------------------------------------------------------------
"Always ... always remember: Less is less. More is more. More is
better. And twice as much is good too. Not enough is bad. And too
much is never enough except when it's just about right."
                        -- The Tick
------------------------------------------------------------

Reply via email to