Lists Home |
Date Index |
- From: David Megginson <firstname.lastname@example.org>
- To: "'xml-dev Mailing List'" <email@example.com>
- Date: Tue, 24 Feb 1998 08:58:41 -0500
Michael Kay writes:
> 1. Is the (ch, start, length) method really necessary, given that one can
> supply a StringReader or whatever to the parse(InputStream) method?
James has convinced me that it's not -- I'm actually happy to drop it,
since I want to keep the interfaces as simple as possible both to
learn and to implement.
> 2. If my "main" XML document is in a record in a database, then it is very
> likely that any other entities referred to will be in the database as well.
> Therefore, I think the logical approach in this situation is for the
> application to resolve all URIs encountered: the parser should call the
> application supplying a URI and the application should return an InputStream
> to allow the parser to read it. This should presumably be done via the
> EntityHandler interface.
I have considered this approach, but I can anticipate two problems:
1) It puts the burdon of resolving URIs on the application rather than
2) It is possible that some programming languages or libraries do not
represent network connections as input streams.
If (2) isn't a problem, we might find a way to work around (1). I'll
be coming back to the EntityHandler interface in a future posting, and
we can take up the issue again then.
> And a question: is there a recommended way to abort a parse once the
> application has got the information it needs (e.g extracting the contents of
> the TITLE element)? Would an interface like parser.abort() be cleaner than
> playing around with exceptions? I ask because in handling the results of a
> free text search, I am parsing all the retrieved documents when I only need
> a bit of text from the beginning of each, and this is obviously wasteful. I
> thought perhaps of supplying a stream and generating a premature
> end-of-file, and then trapping the exception that comes back.
In languages that support exceptions (Java, C++, Perl, and sort-of C),
an exception is probably the cleanest way to handle this. It also
lets you pass application-specific information back to the top level
within your exception.
All the best,
David Megginson firstname.lastname@example.org
Microstar Software Ltd. email@example.com
xml-dev: A list for W3C XML Developers. To post, mailto:firstname.lastname@example.org
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:email@example.com the following message;
To subscribe to the digests, mailto:firstname.lastname@example.org the following message;
List coordinator, Henry Rzepa (mailto:email@example.com)