Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Example 5: Fiction – Short Story Fragment - Page 7

December 19, 2002

This example (shortstory01.xml) shows a fragment of a short story:

<?xml version="1.0" ?>
<content type="fiction" subtype="short">

  <title>The Great Lake</title>

  <authors>
    <author>
      <fname>aeric</fname>
      <mname>sir stinkybutt</mname>
      <lname>halfacat</lname>
    </author>
  </authors>
<page url="/stories/fiction/short/thegreatlake.html"/>

<body>
  <p>The small rowboat rocked violently from the wake of the large
    speedboat that passed. Brent waved with one hand, the other still
    holding his fishing rod. Joe harumpphed. \"Damn idiots. No
    respect for others.\"</p>
  <p>\"What now, Dad?\" Brent asked.</p>
  <p>\"Did you see how close they came, son?\" Joe responded. \"They were
    too close by at least 15 feet.\"</p>
  <p>\"Yeah, I guess you're right,\" Brent agreed. \"But what can we do
    about it?\"</p>
  <p>\"Do? We can't do nothing, boy. If the harbor patrol wasn't so damn
    busy making sure the lake was full of water, they'd be paying
    attention to stuff like this. But we can't do nothing. Not one
    thing.\" A distant look came into Joe's eyes.</p>
  <p>\"Dad?! What are you up to now?\" Brent asked. \"I know that look,
    Dad. You're thinking of some form of revenge.\"</p>
  <p>\"Nothing that shouldn't be done, son. Did you happen to catch the
    name on that boat? Never mind, I got it. Give me that pen over
    there…\" Just then, Joe's fishing line gave a mighty tug. \"Whoa. I
    think I caught a big one!\" Joe reeled in his line as fast as he
    could, fighting the tugging, only to discover that he'd bagged an
    old tire. \"Just what the hell would a car tire be doing in the
    middle of the lake? I never understand people. It's bad enough
    that they pollute. But some seem to go to great lengths to do
    so.\"</p>
  <?timechange ?>
  <p>Joe and Brent made their way in to shore. Brent jumped out and
    tied up the boat to their small berth, then helped his father to
    unload the gear. \"Wait a minute, son. I want to talk to the harbor
    patrol.\"</p>
  <p>Brent stood with the gear while Joe made his way down the docks to
    the little boathouse office that the harbor patrol maintained. Joe
    had a way with people, despite his general crotchety composure,
    which made people laugh and agree to more things than they might
    normally do. In the distance, he could see the on-duty
    harbormaster <?check term?> laughing away with his father.
    Whatever Joe had said, the harbormaster had given him a salute and
    re-entered the boathouse.</p>
  <p>\"I know you're up to something, Dad,\" Brent said when his father
    returned.\"</p>
  </body>
</content>

Note that this is not necessarily the best way to represent the content of a short story. To allow for later update in batch mode, the appropriate <? processinginstruction ?> PIs would have to be defined. However, such instructions would need a means to reference paragraphs for adding, editing, or deleting. One possibility is to change the tagset slightly. For example, we could number the paragraphs by adding a num attribute to each start <p> tag. This would provide the short story application component a means of numbering paragraphs. Then we could insert several paragraphs, after the first one above, as follows:

<?selectdoc type="fiction" subtype="short" title="The Great Lake" ?>
<?insertpara after="1" ?>
<p num="1.1">...</p>
<p num="1.2">...</p>
<p num="1.3">...</p>
<p num="1.4">...</p>

This is simply one possible method. The database is a very simple and open starting point for building a variety of content management systems using XML.

Example 4: Recipes - Page 6
Professional PHP4 Web Development Solutions
Example 6: Resume - Page 8


Up to => Home / Authoring / Languages / PHP / WebDevSolutions




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers