An explanation of XML using SpongeBob and Reindeers
Posted: 10/20/2005 9:29:08 AM
By: Comfortably Anonymous
Times Read: 2,089
0 Dislikes: 0
Topic: Programming: Web Applications
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)
Rating: (You must be logged in to vote)