SAX: External Entity Start and End (question 2 of 10)

David Megginson ak117 at freenet.carleton.ca
Sat Jan 3 15:10:13 GMT 1998


[SAX is a proposal for a simple, event-based XML API, using
callbacks.  This is one in a series of ten design questions that we
need to answer to implement the API.]

Should SAX generate events for the start and end of an external
entity?

  public void startEntity (String ename, String systemID);
  public void endEntity (String ename);


CON
---

- these will make SAX slightly larger;

- these belong to the physical structure of the XML document, while
  SAX concentrates on logical structure;

- these will be difficult concepts for non-XML people to understand;

- a SAX application should always see a single document, regardless of
  the entity structure.


PRO
---

- if an application is derived from XmlAppBase, it can simply ignore
  these events if it doesn't need them;

- many XML-related proposals use URLs or URIs in attribute values and
  in processing instructions; if relative URIs need to be resolved
  against the location of the external entity rather than the location
  of the document entity, then the user will have to have a way to
  determine the location of the current external entity.


MY RECOMMENDATION
-----------------

Qualified yes.

It may be that without these events, SAX is incapable of supporting
XLL, XSL, or architectural forms; if this turns out to be the case,
then SAX will not be useful for a large range of XML applications.

The key is whether, when I have something like

  <link href="foo.xml">link to foo</link>

an application is supposed to resolve "foo.xml" against the URI of the
current entity, or the URI of the document entity.


OTHER CONSIDERATIONS
--------------------

Are public IDs important enough to be included?

    public void startExternalEntity (String ename, String publicID,
                                   String systemID)

We could simplify things further for most users if the XmlAppBase
class implemented final versions of these handlers and maintained its
own entity stack, providing an additional getCurrentEntity() query
method (not part of the interface).



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