|Oracle8i Application Developer's Guide - XML
Release 3 (8.1.7)
Part Number A86030-01
Customizing Content with XML: Dynamic News Application, 9 of 16
The application builds semi-dynamic pages by combining pregenerated lists. The lists of items per category are pregenerated by the administrator (one XML file for each category), but pages that contain them are customized for each user. End-users choose categories such as Sports, Business, and Entertainment.
When to Use Semi-Dynamic Pages
The semi-dynamic approach is useful when the data doesn't change very often and you want to give the end-user a relatively small number of choices. An application that offers more choices has to pregenerate more documents, and benefits degrade proportionally.
How Semi-Dynamic Pages Work
Figure 6-3 shows how semi-dynamic generation works. There are two phases:
- Phase 1 - Static Processing Phase: An administrator uses the Administration Servlet periodically to pregenerate XML files and store them in CLOBs in the database. You could also store them in a simple flat-file system, trading the benefits of the database for potential performance gains.
- Phase 2 - Dynamic Processing Phase: This phase begins when an end-user requests news items from specified categories. A servlet pulls CLOBs from the database and combines them into one XML document. It stores user preferences both in the database and in a client-side cookie, and reads them from the cookie where possible to improve performance. It then transforms the XML document into an HTML page using a XSL stylesheet matched to the end-user's browser. As with static pages, the servlet gets the browser type from the user-agent header of the HTTP request.
Figure 6-3 Dynamic News: Semi-Dynamic Pages - Generating XML Documents