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] XML attributes are weird

On 12/21/13 4:31 PM, James Fuller wrote:
Simon St. Laurent went fishing in this post


and no one took the bait ... I thought xml-dev would go an entire year
w/o the elements vs attributes permatopic ... how wrong I am.
Roger is generally a better fisherman than I am. He's smart to ask on this list about XML-specific issues, rather than wandering to markup or (God forbid) HTML.

Its the holidays so lets put some fuel to the fire;
I'm not sure whether it helps the fire, but your rules are pretty much the same advice I give to people with these questions.



Rule #1 - If you don't know how to use attributes, use an element ... an
element can represent everything you need to use w/o the conceptual
overload. Feel free to complain to anyone who will listen.

Rule #2 - If you have information that itself does not need to be marked
up then you might have a candidate for an attribute. Alternately if you
have content that you insist on having no structure/markup then an
attribute might be for you.

Rule #3 - When you use attributes, you don't care about whitespace, you
don't care about sorting ... in fact think of it as a magical place
which lives out of band in a non dimensional space(I didnt say anything
about ns right ...). There could be optimisation opportunities here if
one cared about it.

I don't think of name value pairs as the right canonical example of
attributes ... its looking at XML purely through the 'data prism', as a
compromise it will do in a pinch ...

from the 'document prism' the commonplace anchor tag demonstrates
succinctly why an attribute may be useful, but c'est la vie, others may
argue otherwise.

To me XML does something interesting in that it roughly
externalizes/mirrors a parse tree that would get built internally when
you do anything with it (represent data, document or a programming
language) ... attributes give you another leaf type to play with and
there is where the sweet siren song can lead one astray when designing a
markup language (and thinking too far ahead of how you are going to
process it).

Anyhow lets see if we can push another 100+ thread out before the New Year!

Jim Fuller

On Sat, Dec 21, 2013 at 9:39 PM, Costello, Roger L. <costello@mitre.org
<mailto:costello@mitre.org>> wrote:

    Hi Folks,

    Why did the founding fathers of XML create attributes?

    XML attributes are weird.

    They make XML documents dirty, messy, cluttered, and, well, ugly.

    XML elements are a perfectly satisfying way of defining name-value
    pairs. XML attributes is a special (i.e., extra, extraneous,
    redundant) way of including name-value pairs in the XML. That's awful.

    Unless ....... the creators of XML intended attributes for another

    I am reading a wonderful book on parsing and it talks about
    extending grammars with attributes; those attributes are used to
    specify the grammar's semantics.

    Hey, XML is a grammar: that's what XSD and RNG are all about, they
    define grammars.

    So maybe what the founding fathers of XML really had in mind with
    attributes is that they be used to enrich XML grammars with semantic

    Are any of the original founding fathers of XML out there? What were
    you thinking when you put attributes into XML? Perhaps you were
    thinking of attribute grammars?



    XML-DEV is a publicly archived, unmoderated list hosted by OASIS
    to support XML implementation and development. To minimize
    spam in the archives, you must subscribe before posting.

    [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
    Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
    subscribe: xml-dev-subscribe@lists.xml.org
    List archive: http://lists.xml.org/archives/xml-dev/
    List Guidelines: http://www.oasis-open.org/maillists/guidelines.php

Simon St.Laurent

[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