OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: DTD Question: Attributes vs Elements

[ Lists Home | Date Index | Thread Index ]
  • From: "Simon St.Laurent" <simonstl@simonstl.com>
  • To: Kurt Donath <kurt.donath@lmco.com>, xml-dev@ic.ac.uk
  • 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.

Simon St.Laurent
XML: A Primer
Sharing Bandwidth / Cookies

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS