Why are the single character read calls there? They unnecessarily
complicates the interface.
> public class InputSource {
> // For each variable, imagine a get/set pair instead...
> public ByteStream byteStream;
> public CharacterStream characterStream;
> public String encoding;
> }
>
> The nice thing here is that all of these can live on separate systems
> in a distributed environment: the InputSource can be a C-program on a
> VAX, the CharacterStream can come a Python program running under alpha
> Linux, and the parser can be running in Java on a Windows box. There
> is no dependency on language- or system-specific features (except for
> java.lang.String, which should be able to map predictably to other
> languages).
>
> Now, why not take this a step further?
>
> public class InputSource {
> // For each variable, imagine a get/set pair instead...
> public String publicId;
> public String systemId;
> public ByteStream byteStream;
> public CharacterStream characterStream;
> public String encoding;
> }
>
> We'd have to define rules of precedence:
>
> 1) if there is a character stream, use it;
>
> 2) if there is no character stream but there is a byte stream, use the
> byte stream;
>
> 3) if there is neither a character stream nor a byte stream but there
> is a system identifier, open a connection to the system identifier;
>
> 4) if there is no character stream, byte stream, or system identifier,
> throw an exception (or invoke the ErrorHandler).
>
> 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.
James