SAX: New Idea for Entity Resolution
David Megginson
ak117 at freenet.carleton.ca
Wed Apr 15 18:23:01 BST 1998
Here's a different idea for SAXEntityResolver, that would add the
ability for an application to return a character stream for _any_ URI
(rather than just the document root):
public interface SAXEntityResolver {
public abstract String filterSystemId (String publicId, String systemId);
public abstract SAXCharacterStream openCharacterStream (String systemId);
}
Here's how this would work:
1. The SAXParser calls the resolver's filterSystemId() method to see
if the system ID needs to be translated. If filterSystemId()
returns null, the parser will use the default system ID; if it
returns a string the will use that string as the system identifier.
2. The SAXParser calls the resolver's openCharacterStream() method to
see if the application wants to open its own character stream. If
openCharacterStream() returns null, then the parser will take care
of opening a character stream itself; if it returns a character
stream, then the parser will use that character stream for the
entity.
I like this approach because it does not add a new interface to SAX,
because it is consistent (in both cases, a null return value means
'let the parser do it'), and because it nicely separates the functions
of resolving identifiers and connecting to them.
It will, of course, not be necessary for most SAX application writers
to use this interface; when they do, however, they will be able to
handle _any_ URI scheme, and not just URLs.
On an even more interesting level, the object implementing this
interface could be sitting on a remote ORB and shared by many SAX
implementations (sort of like a DNS server).
On the down side, I don't think that it will be possible to build this
into a driver on top of any existing Java-based SAX parser, at least
without minor internal modifications.
Comments?
All the best,
David
--
David Megginson ak117 at freenet.carleton.ca
Microstar Software Ltd. dmeggins at microstar.com
http://home.sprynet.com/sprynet/dmeggins/
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list