With the Foobar Public Library allowing access to an XML listing of its new books, is moving closer to its goal of providing up-to-date content to its customers. In addition, already has an established standard for using Java for application development. This makes the process of accessing and using the XML from the library even easier, as Java has the excellent support for XML we have been looking at throughout this book. You’ll need to allow to provide an online listing of new books first, and then look at how to get this information out to its customers automatically.

Filtering XML Data

If you remember, the Foobar Public Library allowed books on several different subjects to be entered into its system; wants only the books about computer-related subjects. Fortunately, the library captured this information in the subject attribute of the book element for each book in its XML data. The first task is to filter out any book whose subject is not “Computers”. Once the technical books have been obtained, they should be formatted into an HTML page that can be shown to customers visiting

For this company and application, there is no static HTML, since the page showing new listings must be generated each time it is accessed. I’m going to use a servlet here for handling these responses. Although Apache Cocoon would be an excellent choice for converting the XML data from the library into an HTML ...

Get Java and XML, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.