XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] 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]


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

Copyright 1993-2007 XML.org. This site is hosted by OASIS