Previous | Table of Contents | Next |
<?xml version="1.0"?> <CATITEM CATEGORY="Clock"> <ITEMNAME>Jimbo's Super Clock</ITEMNAME> <DESCRIPTION><STORY>Ever wake up in the morning to discover that your alarm clock didn't go off because the power failed? Or that your roof leaked, it rained, and the stupid thing just plain shorted out when it got wet? Now you don't have to worry about waking up two hours after you were supposed to be at work.</STORY> <FEATURES>Our latest, greatest Super Clock is a dream come true. It plugs into the wall but has its own set of batteries and protection from short circuits. The batteries even warn you when they're starting to fade - and they come with a twenty- five year guarantee! This clock is completely watertight, a sealed sphere of time in a stainless steel case. The clock face is large enough to read from a distance, and lights up with a touch for those nights when you're stumbling in the dark. The alarm starts off quiet, but gets louder and louder when you don't turn it off - guaranteed to wake even the soundest sleepers. Snooze features let you sleep just a little bit more, but it won't let you sleep in for more than an hour past the alarm. This clock is ready to adorn your bedroom, and even includes connections for lamp controls to brighten your morning, and electroshock clips for those who can't wake up any other way.</FEATURES></DESCRIPTION> <PICTURE SRC="supclock.gif"/> <ITEM><PRODNAME>Jimbo's Super Clock</PRODNAME>: <PART>SC45-A</PART> <PRICE>$199.95</PRICE> (<AIRF>$19.95</AIRF> freight/air, <GROUNDF>$7.95</GROUNDF> ground) <WARRANTY>Twenty- five year</WARRANTY> Warranty. Made in <ORIGIN>Canada</ORIGIN></ITEM> <ITEM><PRODNAME>Lamp Controller</PRODNAME>: <PART>LC45-X</PART> <PRICE>$25.95</PRICE> (<AIRF>$9.95</AIRF> freight/air, <GROUNDF>$4.95</GROUNDF> ground) <WARRANTY>Ten year</WARRANTY> Warranty. Made in <ORIGIN>Canada</ORIGIN></ITEM> <ITEM><PRODNAME>Electroshock Clips</PRODNAME>: <PART>ES45-L</PART> <PRICE>$59.95</PRICE> (<AIRF>$9.95</AIRF> freight/air, <GROUNDF>$4.95</GROUNDF> ground) <WARRANTY>One- year</WARRANTY> warranty. Made in <ORIGIN>USA</ORIGIN></ITEM> </CATITEM>
As you can see, this starts to get very complicated. For simplicitys sake, Ive left out all formatting information, but you can add it with HTML tags if you want to see this in a browser. This catalog information could also be intended for print, a CD-ROM, or even an infomercial. With appropriate style sheets or other formatting tools, you could turn this into an attractive layout on a printed page, a Web page, a screen on a CD-ROM, or a script for an informercial complete with the price and a picture of the item for the order information section of the screen. Although XML may seem picky, requiring you to close all your tags and pay close attention to your syntax, youll quickly find that the document management flexibility you gain by adhering to this discipline is considerably more useful than the document creation flexibility you lost.
Although its a lot of fun to hand-code documents when youre developing the tags yourself, most XML probably will be coded using programs similar to the ones developers currently use for HTML. (Much XML will be generated directly out of databases, cutting individual coders even further out of the process.) XML has much stricter standards to meet and is considerably less forgiving of missing tags than HTML. Figuring out where you forgot a tag can be frustrating under the best of circumstances, and the tools at present are fairly primitive.
One of the best of the early tools for checking your work is Lark, a nonvalidating parser for XML documents. (Validating parsers check the XML markup against a DTD, whereas non-validating parsers only check to make sure that the document is well-formed. Lark isnt exactly beautiful, but it does a very good job of presenting the structure of documents and exposing the parts in the way that a parser or browser will interpret them. (If you want to frighten yourself, apply it to some HTML documents and see how many errors it finds. Lark ignores the HTML empty elements, so using <BR> without closing tags will not register as an error.) Lark is a Java application developed by Tim Bray, one of the editors of the XML specification, and is available with much (though not all) of its source code at http://www.textuality.com/Lark/.
Previous | Table of Contents | Next |