Example 2: Online Manual - Page 5
December 19, 2002
This example (onlineman01.xml) sets up a placeholder document for an online manual:
<?xml version="1.0" ?>
<content type="nonfiction" subtype="onlinemanual">
<title>Guide to the TOOLS Language - Online Edition</title>
<authors>
<author>
<fname>mookie</fname>
<mname/>
<lname>mouse</lname>
</author>
</authors>
<page/>
<body>
</body>
</content>
Currently, there is no content in the <body>
</body> block. Content might be added later in batch
mode as follows:
<?selectdoc type="nonfiction" subtype="onlinemanual" title="Guide to the TOOLS
Language - Online Edition" ?>
<?definebody ?>
<body>
<toolsmanual>
<functions>
<function>
<name>print()</name>
<params>
<param><i>stringexpr</i></param>
</params>
<function>
</functions>
</toolsmanual>
</body>
The application component that parses the above would select the appropriate document from the database
and then add the segment of markup code. The component would have to have some scheme for adding
functions to the online manual. One possibility, of course, is adding functions in alphabetical order.
Example 3: Geek Poetry
This example (geekpoetry01.xml) defines an arbitrary document of the type 'geek poetry':
<?xml version="1.0" ?>
<content type="poetry" subtype="geek">
<title>ODE TO PHP</title>
<authors>
<author>
<fname>golly</fname>
<mname/>
<lname>gee</lname>
</author>
</authors>
<page/>
<body>
<stanza>
<line>$str = "How do I love PHP?</line>
<line>Let me count the ways.</line>
</stanza>
<stanza>
<line>I love thy dynamic typing,</line>
<line>With options galore.</line>
<line>Strongly typed languages</line>
<line>Are such a bore.</line>
</stanza>
<stanza>
<line>My data type mistakes</line>
<line>Are my own to make</line>
<line>That's an option</line>
<line>That I choose to take.</line>
</stanza>
<stanza>
<line>I love thy ease of use,</line>
<line>And focus on the web.</line>
<line>I love that I can weave</line>
<line>Web apps quickly - thanks, Zeev.</line>
</stanza>
<stanza>
<line>I love you PHP</line>
<line>Because you're so simple.</line>
<line>Changing you too much too soon</line>
<line>Would cause such a ripple.</line>
</stanza>
<stanza>
<line>I love you PHP</line>
<line>And so does the "web"</line>
<line>Seven million domains</line>
<line>Just can't be wrong!</line>
<line>";</line>
<line>print $str;</line>
</stanza>
</body>
</content>
General Structure of XML Documents - - Page 4
Professional PHP4 Web Development Solutions
Example 4: Recipes - Page 6
|