mytechbooks.com

With the Foobar Public Library allowing access to an XML listing of their new books, mytechbooks.com is moving closer to their goal of providing up-to-date content to their customers. In addition, mytechbooks.com 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. We need to allow mytechbooks.com to provide an online listing of new books first, and then look at how to get this information out to their customers automatically.

Filtering the XML Data

Mytechbooks.com wants to ensure that only technical books are shown on their web site. If you remember, the Foobar Public Library allowed books on several different subjects to be entered into their system; mytechbooks.com 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 their XML data. Our first task, then, is to filter out all books 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 mytechbooks.com.

For this company and application, there is no static HTML, since the page showing new listings must be generated each time it is accessed. Of course, we use a servlet here for handling these responses. Although ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.