← Prev in month ← Prev in thread
Next in thread → Next in month →

Re: [xml-dev] Don’t create elements with simple co ntent and attributes

From
G. Ken Holman <>
To
Uche Ogbuji <>, "Costello, Roger L." <>
Date
2018-09-28T12:32:48Z
ID
<>
Thread
Re: [xml-dev] Don’t create elements with simple co ntent and attributes
And:

"When Should I Use Elements, and When Should I Use Attributes?"
http://www.oasis-open.org/cover/elementsAndAttrs.html


At 2018-09-27 09:43 -0600, Uche Ogbuji wrote:
>"Principles of XML design: When to use elements versus attributes", 2004:
><https://www.ibm.com/developerworks/library/x-eleatt/index.html>https://www.ibm.com/developerworks/library/x-eleatt/index.html
>
>
>
>On Thu, Sep 27, 2018 at 6:54 AM Costello, Roger 
>L. <<mailto:>> wrote:
>
>Hi Folks,
>
>I hold this to be the fundamental axiom of XML:
>
>Â Â Â Â Â Â Â Â Â  Make the structure of data explicit.
>
>We accomplish that by adding a label (markup) to the data.
>
>There are various terms for this notion of 
>making the structure of data explicit: upconversion and uptranslation.
>
>Elements with simple content and attributes are 
>antithetical to the fundamental axiom of XML.
>
>Here is an element with simple content and an attribute:
>
><Cost currency="USD">8.95</Cost>
>
>Â
>
>The data USD is explicitly labeled. The label 
>indicates that USD is a currency.
>
>What about the data 8.95, is it labeled? No! It 
>is anonymous/unlabeled. Note: Cost is not the 
>label for 8.95; Cost is the label for the whole package.
>
>In my most recent post, I asked, “What is that 
>number (8.95)?” I received excellent 
>responses: 8.95 is a price, 8.95 is an amount, 
>etc. External knowledge was needed to label the 
>data. The need for external knowledge completely 
>contradicts the fundamental axiom of XML.
>
>Therefore, don’t create XML like this:
>
><Cost currency="USD">8.95</Cost>
>
>instead, create XML like this:
>
><Cost>
>Â Â Â  <Currency>USD</Currency>
>Â Â Â  <Amount>8.95</Amount>
></Cost>
>
>Â
>
>Do you agree?
>
>Â
>
>/Roger
>
>Â


--
Contact info, blog, articles, etc. http://www.CraneSoftwrights.com/x/ |
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Streaming hands-on XSLT/XPath 2 training class @ US$45 (5 hours free) |
← Prev in month ← Prev in thread
Next in thread → Next in month →