OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   SAX: Byte Streams and Character Streams

[ Lists Home | Date Index | Thread Index ]
  • From: David Megginson <ak117@freenet.carleton.ca>
  • To: Xml-Dev List <xml-dev@ic.ac.uk>
  • 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
   form possible.

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                 ak117@freenet.carleton.ca
Microstar Software Ltd.         dmeggins@microstar.com

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS