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

Abandon the (mistaken) belief that XML attributes provide"metadata" and

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Sat, 19 Mar 2011 10:54:54 -0400

Abandon the (mistaken) belief that XML attributes provide"metadata" and
Hi Folks,

I just did a search of the XML specification for the word "metadata" 

Number of occurrences: 0


Consider this XML snippet:

  <altitude units="feet">12000</altitude>

I have heard it stated:

   The units attribute provides data about the
   element's data. That is, units provides
   metadata.

However, the XML specification makes no such claim about attributes providing "metadata". This is what the XML specification says:

  Attributes are used to associate name-value pairs with elements.

And then the specification goes on to describe the specific syntax for attributes.

Thus, attributes don't provide data about an element's content. Attributes don't provide metadata.  

Attributes are purely a syntactic construct. 

If you abandon the belief that attributes provide metadata then it frees you to create XML designs based on the capabilities of the applications you use.

Example: In XML Schema 1.1 attributes (but not elements) can be declared "inheritable". There are benefits to having an inheritable item. Namely, descendent elements can make decisions (using the new <assert> element) on inherited attributes. Thus, if it is important to enable the descendants of <altitude> to make decisions based on units and value, then design the XML using exclusively attributes:

   <altitude units="feet" value="12000">
      <!-- descendant elements -->
   </altitude>

In the XML Schema the attributes are declared inheritable:

   <attribute name="units" inheritable="true" />
   <attribute name="value" inheritable="true" />

Note that your decision to make them attributes was not based on whether their values are providing metadata (whatever that means), but rather, based on the ability to exploit inheritance in XML Schema 1.1.

Comments?

/Roger


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