[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: DTD Question: Attributes vs Elements

  • From: "Simon St.Laurent" <simonstl@s...>
  • To: Kurt Donath <kurt.donath@l...>, xml-dev@i...
  • Date: Fri, 19 Mar 1999 15:32:52 -0500

dtd element vs attribute
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
http://www.simonstl.com

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
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@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.