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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: SAX: New Idea for Entity Resolution

[ Lists Home | Date Index | Thread Index ]
  • From: David Megginson <ak117@freenet.carleton.ca>
  • To: "XML Developers' List" <xml-dev@ic.ac.uk>
  • Date: Sun, 19 Apr 1998 07:39:11 -0400

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@freenet.carleton.ca
Microstar Software Ltd.         dmeggins@microstar.com
      http://home.sprynet.com/sprynet/dmeggins/

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