SAX: Comments (question 7 of 10)

David Megginson ak117 at freenet.carleton.ca
Sat Jan 3 18:25:29 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 include an event for comments?

  public void comment (char ch[], int length);


CON
---

- comments are purely lexical, and do not form an integral part of a
  document's information set for processing (as opposed to authoring
  or archiving);

- including comments in SAX might encourage comment abuses like those
  common in HTML (i.e. enclosing 800 lines of JavaScript in a
  comment).


PRO
---

- the DOM includes comments in the core level-one implementation;

- HyTime uses comments for lexical constraints.


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

No.

SAX is not designed for authoring tools or repositories, that need to
preserve the lexical as well as the logical structure of a document,
and there is no compelling reason to report comments here except for
DOM building (and we can always leave them out of a DOM).

The conventional comments in HyTime are not required, and personally,
I believe that they should not have been there in the first place.


FURTHER CONSIDERATIONS
----------------------

Another lexical feature that I am not discussing here is CDATA
sections; I assume that, when the parser is reporting character data,
it does not matter how the parser obtained those characters (in a
CDATA section, or in regular #PCDATA with the delimiters escaped using
references).  I am happy, of course, to listen to other opinions on
this subject.


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