3.2 Creating the Source XML Documents

     

Often, many benefits of using an XML publishing framework such as AxKit become obvious only later in a project's life (e.g., the ability to easily add new heavy-duty features to an existing site, or the power to completely change the look and feel of an entire site without touching its content). Given this, any examples you may choose for this introduction will surely fall short of illustrating AxKit's real power. Accepting the notion that the task at hand is a bit absurd frees you to have a little fun with it while still learning the basics. Let's run with the absurdity, and imagine that you are charged with the task of publishing a small site on the very silly subject of cryptozoology.

Cryptozoology (literally, the study of hidden animals ) is concerned with the gathering and analysis of data related to animals that are frequently reported by local residents or found in popular folklore, but whose existence the scientific community has not formally recognized. Familiar examples include the Yeti, Loch Ness Monster, and Mokele-Mbembe.

The first document for your site, cryptozoo.xml , contains a list of cryptozoological species (called cryptids by insiders). (See Example 3-1.)

Example 3-1. cryptozoo.xml
 <?xml version="1.0"?> <cryptids>   <species>     <name>Jackalope</name>     <habitat>Western North America</habitat>     <description>       <para>         Similar to the Bavarian raurackl (stag-hare), the         North American Jackalope resembles a large jackrabbit         with small, deer-like antlers. This vicious         carnivore is frequently mistaken for common rabbits or hares         suffering from <italic>papillomatosis</italic> (a condition         that produces horn-like growths on the head in those species).       </para>     </description>   </species>   <species>     <name>Dahut</name>     <habitat>French Alps</habitat>     <description>       <para>         A shy relative of the Alpine deer, the Dahut has         adapted to the challenges of its mountainous habitat by         growing legs that are considerably longer on one side         of its body. While this asymmetrical limb configuration allows         for level grazing on steep grades, it leaves the unfortunate         creature unable to reverse its course. Local hunters exploit         this weakness by sneaking up behind the Dahut and either         whistling softly or crying "Dahut!"; when the startled         creature turns to face its assailant, it finds its         longer legs on the wrong side and it tumbles to it doom.       </para>     </description>   </species>   <!--  . . . more species here --> </cryptids> 

No cryptozoology site worth its salt is complete without a list of cryptid sightings. Your second XML document, creatively named cryptid_sightings.xml , contains just that. (See Example 3-2.)

Example 3-2. cryptid_sightings.xml
 <?xml version="1.0"?> <sightings>   <sighting>     <species>Jersey Devil</species>     <location>Bordentown, NJ</location>     <date>Autumn, 1816</date>     <description>       <p>         A Jersey Devil was reportedly seen         by Joseph Bonaparte, former King of Spain         and brother of Napoleon, while hunting in         the woods near Bordentown, New Jersey.       </p>     </description>     <witnesses>       <name>Joseph Bonaparte</name>     </witnesses>   </sighting>   <sighting>     <species>Snipe</species>     <location>Phelan, CA</location>     <date>June 2002</date>     <description>       <p>         The Phelan Phine Snipe Hunters Association         celebrated the opening of this year's Snipe         season. Unfortunately, the entire         photographic record of the event was ruined         during a nasty "keg stand" incident in         the beer tent after the hunt.       </p>     </description>     <witnesses>       <name>Jason Nugall</name>       <name>William Q. Rozborne</name>     </witnesses>   </sighting> </sightings> 

You need one last XML document: a small file that captures the filenames of the two other documents in the site. You will use this bit of metadata to create the navigation in the final result delivered to the requesting HTML browser, so the name nav.xml seems appropriate. (See Example 3-3.)

Example 3-3. nav.xml
 <?xml version="1.0"?> <links>   <a href="cryptozoo.xml">Species</a>   <a href="cryptid_sightings.xml">Sightings</a> </links> 



XML Publishing with AxKit
XML Publishing with Axkit
ISBN: 0596002165
EAN: 2147483647
Year: 2003
Pages: 109
Authors: Kip Hampton

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net