[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: David Carlisle <davidc@nag.co.uk>
  • To: "Costello, Roger L." <costello@mitre.org>
  • Date: Fri, 02 Mar 2012 14:09:10 +0000

Re:  Six Reasons Not to use XML Attributes
On 02/03/2012 13:51, Costello, Roger L. 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.

This is a non argument. csv doesn't have element tags either.
CSV does have two kinds of separator (comma and end of line)

>
> 2.  Avoiding XML attributes makes your language simpler.
Not necessarily simpler, just different. In particular the underlying
tree model may be simpler (one less kind of node) but use may be more
complicated, and the per-language rules you need to specify may be more
complicated.

If the markup is <p id="abc">... then you don't need to say that an
element can only have one ID and that IDs can't have structure, as it is
forced by the syntax. If the markup is
<p>
<id>abc</id>

you have to say both those things, and also whether that form, with
white space before the p does mean the id applies to the p or whether it
has to be
<p><id>abc</id>

>
> 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.

The syntax makes no difference to this point at all. If you view the ID
of an element as data or metadata you will most likely view it the same
way if the syntax is <p id="abc"> or <p><id>abc</id> or indeed "p"
{"id": "abc"}

>
> 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].

Don't see wjt attributes are relevant here
>
> 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>

It could
>
> 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.
>
>
> Are there any more reasons not to use XML attributes?

But Micheal was stating the obvious for effect. Do you really think that
HTML woul dbe simpler (or used by so many people) if it didn't have
mixed content or attributes?
>
> /Roger
>
> [1]
> http://www.xfront.com/The-edge-of-chaos-where-syntax-ends-and-interpretation-begins.pdf
>
>
>
>
[2] https://www.ogf.org/dfdl/
>
> [3] http://lists.xml.org/archives/xml-dev/201112/msg00085.html
>
>

David



-- 
google plus: https:/profiles.google.com/d.p.carlisle

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________


[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.