Announcement: SAX 1998-01-12 Draft
James Clark
jjc at jclark.com
Tue Jan 13 04:25:09 GMT 1998
Some brief comments on the draft:
EntityHandler.changeEntity belongs in DocumentHandler: it's giving you
information that you need to interpret the information that
DocumentHandler provides. It has nothing to do with resolveEntity.
I don't think the doctype() method is a good idea. A external DTD
subset is just a convenient shorthand for declaring and referencing an
external parameter entity. It shouldn't be singled out for special
treatment. Knowing the external doctype isn't very useful without
knowing anything about the internal subset, since the internal subset
can completely change the effect of an external DTD. I think this
method should be dropped. If you want to provide DTD information, do it
properly with a separate DtdHandler interface.
ErrorHandler needs an error method in addition to fatal and warning. It
would be better if all methods had a single argument of XmlException.
AttributeMap seems way too complicated.
I don't think using Enumeration to get all the attributes is a good
idea. JDK 1.2 replaces Enumeration by Iterator. The method names in
Enumeration are a real disaster in the context of XML: nextElement
returns the name of the next attribute! This is not going to be an
efficient way to get at all the attributes (which is a common
application need). To get at all the attributes, I have first to create
an Enumeration (an unnecessary allocation). Then for each attribute
name: I have to make two non-final method calls (nextElement and
hasMoreElements); I then have a cast (which must be checked) from Object
to String; I then have to look the attribute up using getValue. Compare
this to the simple interface I suggested:
void startElement(String elementName, String[] attributeNames, String[]
attributeValues, int nAttributes)
Is AttributeMap required to implement clone? I think it probably ought
to be.
How does AttributeMap deal with implied attributes that are not
specified? I think they shouldn't appear at all.
Does isEntity() return true for ENTITIES attributes? Does isIdref()
return true for IDREFS attributes.
AttributeMap.getNotationNameID is not a good name: getEntityNotationName
or getEntityNotation would be better.
PublicID and SystemID in method names should be PublicId and SystemId
(Identifier is one word not two).
In XmlException, getLine should be getLineNumber for consistency with
java.io.LineNumberInputStream.
Is the first column number 0 or 1? (Emacs thinks it's 0, but the first
line is cleatly 1.)
James
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