In designing markup languages, one of the first questions customers ask
religiously is, "Do you prefer elements or attributes?" In fact, if you
examine many of the current markup languages on the Internet, you often see a
strict schism between those that use mostly (or even exclusively) attributes
and those that use mostly or exclusively elements.
I believe this should not be an either/or proposition because elements and
attributes are not interchangeable even though they have similarities. This
article will examine why this problem exists, the nature of elements and
attributes, and a logical set of rules to determine when each is appropriate
to use.
Element-Centric Approach
Table 1 compares an element-centric approach to an attribute-centric approach
on a canonical example.
The roots of this problem arise due to a collision of two opposing biases. On
the one hand,... (more)