xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip Nye" <phi...@engarts.com>
Subject Re: Attribute and Element
Date Fri, 19 May 2000 08:47:00 GMT
Clark C. Evans wrote:

>  * unordered
>  * non-nestable
>  * usually implemented as an array or hash-table
>  * a bit briefer
>  * good for really short stuff (longer stuff gets ugly)
>  * all attributes are delivered together as one
>    unit in the SAX api.
>  * ordered
>  * nestable
>  * usually implemented as a linked-list
>  * a bit more verbose
>  * good for longer stuff
>  * elements are delivered seperately, sequentially
>    in the sax api.

The other consideration is uniqueness (only one instance of a particular
attribute for any one element).

I would assess it thus:

   Elements: Up to schema designer
   Attributes: Must be unique

   Elements: Up to schema designer - APIs generally preserve order.
   Attributes: original spec does not say but most standard APIs
       will not guarantee to preserve order.

   Elements: yes
   Attributes: no

As Clark says - in raw terms you can do pretty much anything with elements
that you can do with attributes but not vice versa.

Many implementations and designers make all sorts of assumptions about
attributes vs elements which are not expressed in the XML spec and these
assumptions may not be explicit or even shared with others so you need to be


View raw message