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

Re: Six Reasons Not to use XML Attributes

  • From: "Christopher R. Maden" <crism@maden.org>
  • To: xml-dev@lists.xml.org
  • Date: Fri, 02 Mar 2012 12:51:03 -0500

Re:  Six Reasons Not to use XML Attributes
Whenever I hear discussions like this, a line from _Rocky Horror Picture
Show_ always goes through my mind: “I didn’t make him for *you*!”

The primary use case for SGML-for-the-Web was to facilitate
richly-marked-up documents, in the sense of artifacts by and for humans.
 The usefulness of XML for automated data interchange was noted (and had
been observed with SGML as well) and was accommodated, but the primary
use case was still human documents.  Michael Kay was certainly not the
first to note that mixed content and attributes are unnecessary, but the
overwhelming utility of having a default rule of display content and
throw away the rest prevailed.

Consider the default processing rule for HTML browsers: when the ID
attribute was globally added, it made it easy to change:

<p><a name="frankNotForYou"></a><strong>Frank:</strong> I didn’t make
him for <em>you</em>!</p>

to:

<p id="frankNotForYou"><strong>Frank:</strong> I didn’t make him for
<em>you</em>!</p>

Imagine if we had no attributes: a browser might know not to display the
identifier in this:

<p><a><name>frankNotForYou</name></a><strong>Frank:</strong> I didn’t
make him for <em>you</em>!</p>

... but switching to this:

<p><id>frankNotForYou</id><strong>Frank:</strong> I didn’t make him for
<em>you</em>!</p>

... would have looked very strange in older browsers, and so adding any
kind of new metadata would have been a non-starter.

Although it is true that one person’s data is another’s metadata, there
is still a presumption in XML default processing (e.g., the XSLT default
templates) that content is visible and attributes are not.  When working
with machine interchange languages, this doesn’t matter, but for human
documents, it is a good principle to follow.

~Chris
-- 
Chris Maden, text nerd  <URL: http://crism.maden.org/ >
“Be wary of great leaders.  Hope that there are many, many small
 leaders.” — Pete Seeger


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.