An explanation of XML using SpongeBob and Reindeers

As the father of a five-year-old, I’ve seen my share of SpongeBob episodes. In one episode, Squidward, an artsy, highbrow wannabe, is trying to create a marching band with a bunch of horrible Realizing that the situation is hopeless, he comes up with an idea. He asks how people try intelligent. Plankton, a pseudo-intellectual bent on world-domination, speaks loudly. “They loudly,” he says. The band then attempts to play as loudly as possible in order to make people they’re good.

I have a theory that another way people try to look intelligent is to use lots of acronyms. approach is used at corporate business meetings on a daily basis. It is also why mathematicians so smart. They don’t even bother with acronyms—they extend the concept by using letters represent numbers and other objects of interest. The practice of looking intelligent by the overuse acronyms is the theme of this chapter. XML is so simple it’s difficult. When you see it, you’re wondering where the rest of it is. Listing 17.1 shows an example of an XML file.

Listing 17.1: New-School Reindeer Data




Dasher
Contemptuous
Black


Donner
Optimistic
Black


Rudolph
Cheerful
Bright Red



Without knowing anything about XML, it is easy to tell that this is a collection of reindeer, and for each reindeer, three characteristics are provided—the name of the reindeer, the disposition of the reindeer, and the color of its nose. If this data were in a standard text file, it might look something like Listing 17.2.

Listing 17.2: Old-School Reindeer Data

"Dasher", "Contemptuous", "Black"
"Donner", "Optimistic", "Black"
"Rudolph", "Cheerful", "Bright Red"

Although Listing 17.2 is more compact than its XML counterpart, if you weren’t familiar with the underlying data, which way would you prefer to receive it? How would you know what the data was in Listing 17.2? Many times, I’ve received text files to work with that didn’t contain field names as the first row. I could ask the person who gave it to me to include field names, but this isn’t always practical.

(From Mastering Excel 2003 Programming with VBA, Steven M Hansen, Sybex 2004)
Reply
This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available in our efforts to advance understanding of environmental, political, human rights, economic, democracy, scientific, and social justice issues, etc. We believe this constitutes a 'fair use' of any such copyrighted material as provided for in section 107 of the US Copyright Law. In accordance with Title 17 U.S.C. Section 107, the material on this site is distributed without profit to those who have expressed a prior interest in receiving the included information for research and educational purposes. For more information go to: http://www.law.cornell.edu/uscode/17/107.shtml . If you wish to use copyrighted material from this site for purposes of your own that go beyond 'fair use', you must obtain permission from the copyright owner.