[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

SAX: Byte Streams and Character Streams

  • From: David Megginson <ak117@f...>
  • To: Xml-Dev List <xml-dev@i...>
  • Date: Fri, 17 Apr 1998 20:58:42 -0400

sax parser characters byte
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
   entity; 

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

-- 
David Megginson                 ak117@f...
Microstar Software Ltd.         dmeggins@m...
      http://home.sprynet.com/sprynet/dmeggins/

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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.