Lists Home |
Date Index |
- From: "Simon St.Laurent" <firstname.lastname@example.org>
- To: Kurt Donath <email@example.com>, firstname.lastname@example.org
- Date: Fri, 19 Mar 1999 15:32:52 -0500
At 02:33 PM 3/19/99 -0500, Kurt Donath wrote:
>What is the criteria for selecting when to define data as an attribute
>or element in a DTD?
>Simon says attributes are an "excellent tool for passing along extra
>information about your element to an automated processor - a parser, a
>browser, or a conversion tool. They are NOT a good place to actually
>store data". Simon continues, "generally, you should use attributes to
>store information that may not be useful to humans directly but may help
>computers process the element properly."
>Would anyone like to add or differ with this?
I'll just clarify a little bit. In my (highly religious and thoroughly
debatable) viewpoint, attributes are pretty much like annotations. In a
few cases - empty elements in particular, where the attributes are the only
'real' content - attributes do have a direct impact on the content.
Nonetheless, I'm much happier seeing attributes as a description of the
element - more a metadata role - than providing content.
If you use XML in a display environment that isn't oriented toward
transformation, say CSS, the implications are pretty simple: users will see
the element content directly, if you let them, while the attribute content
is used to generate the presentation, not the content. From my
perspective, elements contain 'first class' textual content for humans,
while attributes contain information that people will typically access
directly only through an editor.
In other environments, attributes may seem more or less worthy of storing
content. From a programmer's perspective, elements and attributes are just
different implementations of about the same thing, and RDF's many syntaxes
make this quite clear. I've definitely softened my strong opinions about
this dichotomy, though I certainly know what style I prefer when I go to
write my own DTDs.
XML: A Primer
Sharing Bandwidth / Cookies
xml-dev: A list for W3C XML Developers. To post, mailto:email@example.com
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:firstname.lastname@example.org the following message;
To subscribe to the digests, mailto:email@example.com the following message;
List coordinator, Henry Rzepa (mailto:firstname.lastname@example.org)