Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] reading an xml from a socket

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: John Cowan <cowan AT ccil.org>
  • To: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] reading an xml from a socket
  • Date: Sun, 22 Oct 2006 01:55:38 -0400

Wolfgang Hoschek scripsit:

> Nonetheless, a zero *byte* as an unambigous end-of-document marker
> would work as long as only ASCII or UTF-8 are used.

Or most other encodings, including even EBCDIC, with the exception of
the UTF-16 and UTF-32 families. That's what makes U+0000 termination
better than, say, form feed termination.

> This would be much more straightforward, practical and efficient than
> to append, and scan for, an (encoded) *unicode character* U+0000,
> because, in the general case, the custom Reader would somehow have to
> implement the (non-trivial) XML rules for character encoding detection,
> also to find the encoded U+0000 marker.

By "encoded" I mean character encoding, not XML encoding. IOW, four
consecutive 0x00 bytes in UTF-32 encodings, two consecutive 0x00 bytes
in UTF-16 encodings, and a single 0x00 byte otherwise.

> In addition, as recently discussed in another thread on this mailing
> list, an XML parser/serializer tends to be more reliable and
> efficient if being passed a byte-oriented InputStream/OutputStream,
> rather than a character-oriented Reader/Writer.

Fair enough, particularly given that there is no way to make a
Java InputStreamReader cough up its encoding except as a string name.

--
John Cowan cowan AT ccil.org http://ccil.org/~cowan
If I have seen farther than others, it is because I am surrounded by dwarves.
--Murray Gell-Mann




Archive powered by MHonArc 2.6.24.

Top of Page