The Event Form

   

Imagine you are working for the local newspaper. The newspaper publishes much information, including articles, advertisements, classifieds, and local information such as the agenda of local events.

Event organizers call the newspaper and a clerk collects the data for the event. Obviously, he or she has a form to fill out.

Recently, the newspaper began taking steps toward electronic publishing. The ultimate goal is to make the newspaper available online. Therefore, the paper form must be replaced by an electronic form.

Let's see how you can take advantage of an XML editor to build a simple and familiar editing environment for the clerk. Our ultimate goal is shown in Figure 3.1. The main characteristics are as follows :

  • It's a Word lookalike so it's familiar to the clerk. It is very likely that it will be more familiar than even a browser.

  • It creates real XML documents that look similar to Listing 3.1.

  • Developing it is quick (less than a day) because the editor does all the hard work.

  • It mixes closed and open questions. The name , location, and contact information are fixed fields but the description is open -ended. It can even include formatting (bold, italic) like a word processor does.

Figure 3.1. A familiar environment to edit forms.

graphics/03fig01.gif

One of the most interesting aspects of this project is that it illustrates how XML opens up your application to tools. By choosing the XML format, you gain access to powerful tools, such as the editor, but the underlying format remains XML. So, you always can access it through other mechanisms (for example, building your own application, as you did in Chapter 1, "Lightweight Data Storage"). You also can feed it to other tools (for example, browsers, using the publishing mechanism introduced in Chapter 4, "Content Syndication").

Listing 3.1 bookfair.xml
 <?xml version="1.0"?> <!DOCTYPE Event SYSTEM "event.dtd"> <Event>   <Name>Book Fair </Name>   <Location>Exhibition Center, Namur</Location>   <Date>     <Start>6/3/00</Start>     <End>6/4/00</End>   </Date>   <Contact>     <Name>Robert Martin</Name>     <Phone>081 22 87 34</Phone>   </Contact>   <Description>     <Para>The largest book fair in the area! We're expecting       <Bold>hundreds</Bold> of booksellers covering all genres:       crime, biographies, science-fiction, how-to books and       more!</Para>     <Para>Free entrance and free parking.</Para>     <Para>Join us on Saturday night for the "<Italic>all-books       barbecue</Italic>."</Para>   </Description> </Event> 
   


Applied XML Solutions
Applied XML Solutions
ISBN: 0672320541
EAN: 2147483647
Year: 1999
Pages: 142

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