Lists Home |
Date Index |
- From: David Megginson <email@example.com>
- To: Xml-Dev List <firstname.lastname@example.org>
- Date: Fri, 17 Apr 1998 20:58:42 -0400
James Clark has recently raised the issue of byte streams and
character streams, and I think that we need to give this a thorough
discussion before my self-imposed deadline of next Tuesday.
SAX is based on two general principles, sometimes violated:
1) SAX shall provide the minimum required information in the simplest
2) SAX shall impose as few constraints as possible on the
architecture of XML parser implementations.
One possible violation of both principles is my recent suggestion
(implemented in yesterday's pre-release) that SAX support stream-based
parsing only from character streams and not from byte streams -- the
problem is that James's XP parser works directly from undecoded byte
streams for the sake of speed, and this decision requires XP to
reencode the character stream before parsing it.
There are three possible parsing situations:
a) the application provides the parser with a URL pointing to an XML
b) the application has access to characters (perhaps in a buffer, or
or from a database), and it provides them to the parser in a
character stream; and
c) the application has access to raw bytes (perhaps from a file or a
URL connection), and it decodes them and provides them to the
parser in a character stream.
In the first two situations, the absence of a byte stream creates no
inefficiencies -- in (a), the XML parser can read a raw byte stream
itself, and in (b), either the application or XP will have to encode
the characters into bytes. The only inefficiency is in (c), where the
application will decode the byte stream only to have it re-encoded
into bytes by XP, and this is an inefficiency only if the SAX parser
happens to work directly from raw bytes without decoding them first.
I'd like to hear from XML application writers: which of the above
situations do you find most typical? Is (c) a common situation for
you? Is it common enough that it is worth enlarging SAX and
complicating the EntityResolver interface?
Thanks, and all the best,
David Megginson email@example.com
Microstar Software Ltd. firstname.lastname@example.org
xml-dev: A list for W3C XML Developers. To post, mailto:email@example.com
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:firstname.lastname@example.org the following message;
To subscribe to the digests, mailto:email@example.com the following message;
List coordinator, Henry Rzepa (mailto:firstname.lastname@example.org)