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

XML is Like a Box of Chocolates

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Sun, 4 Mar 2012 14:05:46 +0000

XML is Like a Box of Chocolates
Hi Folks,

XML is like a box of chocolates.

Here's how:

--------------------------------------------------
Organize the Chocolates that I Received
--------------------------------------------------

Recently I received some chocolates:

-  Truffles, I put them in a box and wrote on the outside of the box "Spherical"
-  M&Ms, I put them in another box and wrote on the outside of that box, "Shiny"
-  Chocolate covered peanuts, I received a lot so I divided them into two boxes and wrote on the outside of each box, "Nutty"

I stacked the boxes like so: Spherical on top of Shiny on top of the two Nutty.

Then I took this stack and put them all inside a box and wrote on the outside of that box, "Chocolates"

Oh, I also received a chocolate bar which I hooked on top of the "Chocolates" box.

See how I organized the chocolates?

----------------------------------------------------------------------
What's the Meaning of that Organization of Chocolates?
----------------------------------------------------------------------

I hooked the chocolate bar on top of the "Chocolates" box. Is there some special significance to that?

I placed the two "Nutty" boxes on the bottom of the stack. Is there some special significance to that?

What's the meaning of this organization?

Obviously it has no meaning. It is simply the way I organized my chocolates. To attach meaning to this organization is assigning meaning where none exists. 

XML is like this organization of chocolates. An XML document is just a collection of data where each item of data has been boxed (enclosed in start-tag, end-tag pairs) or hooked onto a box (attribute). There is no meaning to the organization.  

----------------------------
Eating the Chocolates
----------------------------

Today I ate a truffle. When I eat a truffle I like to take my time and enjoy it, so I bite off just a tiny piece, let it sit in my mouth until it melts, and then swallow it; then repeat with the next tiny bite.

My brother, on the other hand, pops the entire truffle into his mouth, chews on it for a few seconds, and swallows it.

--------------------------------------------------
What's the Right Way to Eat Chocolates?
--------------------------------------------------

I eat chocolates in a different way than my brother. Am I right and he's wrong?

Obviously not. We are each entitled to eat chocolates however we desire.

I should mention that I eat brussel sprouts differently than I eat chocolates. For brussel sprouts I pop one into my mouth, quickly chew, and swallow. So if I were doing a blind taste test of various foods, it would be hard for me to know how to eat each food. 

I need to know "what" I am eating to know "how" to eat it.

Analogously, there is no right way to process XML.  To each his own. What is important, however, is to know "what" the data is. 

-------------------------------
Giving Gifts of Chocolate
-------------------------------

I think chocolates are a great gift. So last Christmas I gave a box of chocolates to each of my siblings. 

Earlier I described an organization of chocolates. I used that as a template. For each sibling I made a box of chocolates following that template. That is, to be placed within each "Chocolates" box are:

-  1 box containing truffles
-  1 box containing M&Ms
-  2 boxes containing chocolate covered peanuts.

And hooked onto the "Chocolates" box is a chocolate bar.

------------------------------------------------
What's the Meaning of this Template?
------------------------------------------------

Does the template give meaning to the gift boxes?

Obviously not. The template simply shows "how to" organize the boxes (or, once accomplished, how each box is organized).

Likewise, XML Schema (and Relax NG and DTD) just show "how to" organize data in XML documents. Schemas have no meaning.

---------
Recap
---------

An XML document is just an organization of data. Organization has no meaning. Be careful that you don't implicitly assign meaning where none exists. For example, XML attributes are not "meta-data" and they have no "scope". Analogously, it would be foolhardy to claim that because the chocolate bar is hooked onto the "Chocolates" box it is somehow "meta-chocolate" and it "scopes" all the chocolates inside the box.

XML documents can be processed any way you want. There is no right way. Don't prescribe "how" to process data. However, do describe "what" the data is. But don't depend on the element or attribute names to describe "what" the data is. I labeled the box containing the M&Ms "Shiny", that hardly tells "what" is inside the box. Describe "what" the data is using a data specification and possibly an ontology.

XML Schema (and Relax NG and DTD) are just templates that describe how to organize XML documents. Schemas have no meaning. 

-------------------------
Related Discussions
-------------------------

The Edge of Chaos: Where Syntax Ends and Interpretation Begins (http://www.xfront.com/The-edge-of-chaos-where-syntax-ends-and-interpretation-begins.pdf)  

The XML Literalist (http://www.stylusstudio.com/xmldev/201103/post90060.html)

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.