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

On Fri, Mar 2, 2012 at 7:51 AM, Costello, Roger L. <costello@mitre.org> wrote:
>
> Hi Folks,
>
> 1.  XML attributes are specific to the XML data format. Other data formats,  such as
>    comma-separated values (CSV) and binary, don't have it. That is, taking a (element)
>    name with a (element) data value and then adding to that a (attribute) name/value
>    pair is specific to XML.

By that argument humans should stop using their arms since birds don't
have arms...

> 2.  Avoiding XML attributes makes your language simpler.

No.

>
> 3.  When people use XML attributes they typically assign them some meaning. For example,
>    some people assign attributes the meaning "attributes are metadata." When you enter
>    the land of meaning (and its partner, interpretation) you enter the land of chaos [1]. By
>    eliminating attributes you have one less category of things to give meaning to and one
>    less category of things to be misinterpreted.

So what?  Metadata is data, data is metadata, any border between them
is at best context sensitive and worst an arbitrary whim.  Using
attributes or not,  does not change this issue.

>
> 4.  XML Schemas that do not use xsd:attribute can be used to logically model other data
>    formats besides XML, using the Data Format Description Language (DFDL) [2].

So?  I can use UML to model XML.  That doesn't make it a good idea.

>
> 5.  Attributes are never needed. For example,
>
>          The altitude is 12000 feet.
>
>    can be modeled using an attribute:
>
>         <altitude units="feet">12000</altitude>
>
>    However it can be equivalently modeled using just elements:
>
>        <altitude>
>             <units>feet</unit>
>             <value>12000</value>
>        </altitude>
>

Once more I ask, so?  I could also add 500 paragraphs of more
extraneous tagging to achieve this same result.  Why would I want to?

> 6.  Michael Kay says that attributes are unnecessary [3]:
>
>      XML is too large. Attributes are unnecessary, mixed content is
>      unnecessary, namespaces are unnecessary: without these unnecessary
>      concepts, XSD and many other things would have been much simpler.
>

Michael was yanking your chain, there's sometimes a danger in taking
authorities (or random noise makers such as myself) too seriously...

>
> Are there any more reasons not to use XML attributes?
>

You like extraneous and unnecessary complexity?


Peter Hunsberger


[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