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 :
Figure 3.1. A familiar environment to edit forms.
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>