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

Re: SAX: New Idea for Entity Resolution

  • From: David Megginson <ak117@f...>
  • To: "XML Developers' List" <xml-dev@i...>
  • Date: Sun, 19 Apr 1998 07:39:11 -0400

sax new
James Clark writes:

 [on org.xml.sax.CharacterStream and org.xml.sax.ByteStream]

 > Why are the single character read calls there?  They unnecessarily
 > complicate the interface.

For others in the discussion, here's what I have right now:

  public interface CharacterStream {
    int read () throws SAXException;
    int read (char ch[], int start, int length) throws SAXException;
  }

  public interface ByteStream {
    int read () throws SAXException;
    int read (byte b[], int start, int length) throws SAXException;
  }

I included the single character/byte reads because I did not want to
assume that all SAX parsers do their own buffering (of course, the
buffering could be handled in the SAX driver layer if necessary).  

It also seems strange to me to have a streaming interface that does
not allow single character/byte reads, though I know that these would
be horribly inefficient in a distributed environment where the Parser
and the CharacterStream or ByteStream are on different systems.

What do the other parser writers think?  Does anyone want or need
single-character or single-byte reads?  I'm very happy to prune SAX
wherever I can, before we get to the final release.

 [on the new InputSource class]

 > > Now, we can get away with only one parse() method in
 > > org.xml.sax.Parser:
 > > 
 > >   public abstract void parse (InputSource source)
 > >     throws Exception;
 > 
 > I don't think this is a good idea: it makes SAX harder to use in the
 > simple case of reading from a URL.

In that case, then, it would probably be best to have two:

  public abstract void parse (String systemId)
    throws Exception;

  public abstract void parse (InputSource source)
    throws Exception;

The first would be the exact equivalent of

  public void parse (String systemId)
    throws Exception
  {
    parse(new InputSource(systemId));
  }

Does this seem reasonable?


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.