classpathx-xml
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Classpathx-xml] ReaderInputStream vs XmlParser declared and detecte


From: David Brownell
Subject: Re: [Classpathx-xml] ReaderInputStream vs XmlParser declared and detected encodings
Date: Mon, 6 Dec 2004 09:25:33 -0800
User-agent: KMail/1.7.1

On Sunday 05 December 2004 3:41 pm, Chris Burdess wrote:
> Mark Wielaard wrote:
> > On Sun, 2004-12-05 at 16:46, Mark Wielaard wrote:
> >> But this seems a deeper problem with handling InputStream <-> Reader
> >> interaction combined with XML documents that declare their own 
> >> encoding.

There's no problem with using a Reader with its "external"
encoding declaration model, except when combined with
documents using the "internal" encoding declaration model.


> >> I don't have a clue how to handle it properly though since when you   
> >> use a Reader you do that to hide the underlying encoding in the first 
> >> place, so it doesn't mix well with documents declaring their own
> >> encoding format...
> 
> Right. XML doesn't make a lot of sense with Readers, and I consider the 
> specification of character streams in the SAX and JAXP APIs to be a 
> design error.

I'd put it differently.  The problem is applications mixing the
two models of encoding declarations ... and it's intrisic to
XML rather than those APIs.  They can always get out of sync,
no matter what API you use; consider a website serving XML with
an encoding in the MIME type which doesn't match the one in the
document itself.

There may be better ways to handle that problem in software,
but the root cause is not in any Java code.

- Dave




reply via email to

[Prev in Thread] Current Thread [Next in Thread]