Re: SAX: Attributes

Sean Mc Grath (digitome@iol.ie)
Sun, 4 Jan 1998 23:40:05 GMT


>
>The alternative is to return to what I had originally done with
>=C6lfred, and generate a separate event for each attribute:
>
> public void attribute (String elementName, String aname, String value);
>

Separate attribute events raises a question.

Unlike SGML, XML does not specify that the order in which attribute values
are supplied in a start-tag is insignificant to applications.
(Perhaps I missed something it in the spec.?). A processor working
sans DTD obviously cannot determine a declaration order in which to generate
the events.

Annex G of the SGML handbook just says the order is insignificant. However,
nsgmls ESIS supplies then in declaration order and I for one have written
apps that relied on that. Perhaps writing apps that rely on a specific
order of attribute event arrival is just plain bad design!

Anyway, the dictionary approach, supplying all the attributes in one go
side-steps buffering and state space for simple little SAX apps. that want
to pick
up attributes X and Y of element Z and nothing else.

While on this subject, what comes first, a start-tag event or its attribute
event(s)?

Sean Mc Grath
sean at digitome dot com