Announcement: SAX 1998-01-12 Draft

Tyler Baker tyler at infinet.com
Tue Jan 13 04:45:24 GMT 1998



James Clark wrote:

> 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.
>

I was sorta confused by this method as well.  I think that a DTD handler
interface would be nice, since it is a totally separate beast from the document
itself.  In this case, you might have an internal as well as external DTD handler
interface so that the appropriate overrides can be made by the internal DTD
information after the external DTD is handled.

> ErrorHandler needs an error method in addition to fatal and warning. It
> would be better if all methods had a single argument of XmlException.
>

For callbacks I am not so sure that you need a new Exception to encapsulate data
that could be passed as arguments.

> 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)
>

I think it would be better to have an array of Attribute objects.

public class Attribute {
  public String name;
  public String value;
}

You could make these private and provide accessor methods.  Also, you could have
a set of query methods similiar to what is currently in AttributeMap.

> Is AttributeMap required to implement clone?  I think it probably ought
> to be.
>
>

I am not sure why it is necessary to be clonable.

> In XmlException, getLine should be getLineNumber for consistency with
> java.io.LineNumberInputStream.
>

Good idea...

Tyler


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