|
||||||||
| Chapter 1 - Introducing the X-Team | |
| XSLT For Dummies | |
| by Richard Wagner | |
| Hungry Minds 2002 | |
XML: Storing Your Data
The original member of the X-Team is eXtensible Markup Language (XML), the granddaddy of them all. All other X-Team
Since its beginnings, the Web has used HyperText Markup Language (HTML) to display content. HTML documents are stored on Web servers and then sent on demand to a Web browser, such as Microsoft Internet Explorer or Netscape Navigator. The browser then displays the HTML as a Web page. Figure 1-1 illustrates this process.
HTML comes up shortHTML has become so wildly popular largely because its very easy to learn and work with; heck, even my 7-year-old can create a Web page using Microsoft FrontPage, and my 9-year-old can write HTML by hand. The markup language was originally designed purely as a way to format and lay out information. However, because people have wanted to use the Web for nearly every task under the sun, HTML has been forced to do far more than was ever intended. Consider a familiar scenario: A company wants to put information stored in a database onto its Web site. A sampling of its data might look something like Table 1-1.
To present this information on the Web, these database records must be converted into HTML text and formatted properly as a table so that they can be
<table border="1"> <tr> <th>ID</th> <th>Name</th> <th>City</th> <th>St</th> <th>Zip</th> </tr> <tr> <td>100</td> <td>Ray Kinsella</td> <td>Anderson</td> <td>IN</td> <td>46011</td> </tr> <tr> <td>101</td> <td>Rick Blaine</td> <td>Manchester</td> <td>NH</td> <td>02522</td> </tr> </table>
Look closely at the above code to see how HTML
Such a solution would be acceptable if you only want to display information in a Web browser, but many people are discovering needs that go far beyond that. For example, searching for information within an HTML document is very limited. How would I be able to retrieve from my HTML file the
Think of HTML as a
In other words: Yes, the shake tastes great, but dont try to use the raw materials again for a different purpose.
XML to the rescue
Developed as a response to the information-blender effect of HTML, XML is simply a practical way to work with structured information on the Web. The motivation of its inventors was to assemble structured data into something that was similar to HTMLso that data could be easily readable by people like you and mebut different enough from HTML so that its
Whether you realize it or not, almost all the information used on the Web has a natural structure or organization to it and thus can be
<letter> <date>March 31, 2002</date> <salutation>Dear Sir:</salutation> <text>Thanks for your recent article on Swiss Cheese chips. However, I don't think you gave enough credit to the farmer who invented the Swiss Cheese chip - Charley Cowley.</text> <closing>Warm Regards,</closing> <signature>Mrs. Charlie Cowley</signature> </letter>
<dialogue> <rick>I'm saying it because it's true. Inside of us, we both know you belong with Victor. You're part of his work, the thing that keeps him going. If that plane
<customers> <customer> <id>100</id> <name>Ray Kinsella</name> <city>Anderson</city> <state>IN</state> <zip>46011</zip> </customer> <customer> <id>101</id> <name>Rick Blaine</name> <city>Manchester</city> <state>NH</state> <zip>02522</zip> </customer> </customers>
<html> <head> <title>My Home Page</title> </head> <body> <h1>Heading</h1> </body> </html> From these examples, you can see that XML describes information in a very logical and straightforward manner. Put descriptive tags before and after the text values and youve just about got an XML document. XML isnt rocket science!
HTML is standardized with a fixed set of formatting tags or
elements
to define different
<account id="10001010"> <type>Checking</type> <rating level="-5"/> <customer preferred="no way, hosea"> <firstname>John</firstname> <lastname>Charles</lastname> <address>123 Main Street</address> <city>Fremont</city> <state>CA</state> <zip>94425</zip> </customer> </account> Or, a pizza store chain can come up with its own set of XML elements that describes their pizzas.
<pizza> <size value="Mega"/> <crust type="Thick and Chewy"/> <toppings>Olives, Sausage, Pepperoni, Lima Beans</toppings> <cookingtime>30</cookingtime> </pizza> Tip A set of defined XML tags used for a particular purpose is an XML vocabulary . However, as great as it is at organizing information, XML by its very nature is a raw material. XML is of little use by itself and needs help from its X-Team teammates to actually make its information usable in the real world.
|
||||||||||||||||||||||||||