O'Reilly logo

MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL by James Turner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A DTD for Products

First, you'll look at reading data from XML files using Xerces. Reading in the product list for the BFG site serves as a good example. To see how this works, you'll begin by writing a DTD to represent products in your shopping cart application so that you can add new books to the database from an XML file (see Listing 14.1).

Listing 14.1. Product.dtd
 <?xml version='1.0' encoding='UTF-8' ?> <!ELEMENT File (Product)*> <!ELEMENT Product (Title, Authors, Price, Pubdate, Description, Categories)> <!ATTLIST Product ISBN CDATA #REQUIRED > <!ELEMENT Title (#PCDATA)> <!ELEMENT Authors (Author)+> <!ELEMENT Author (#PCDATA)> <!ELEMENT Price (#PCDATA)> <!ELEMENT Pubdate (#PCDATA)> <!ELEMENT Description (#PCDATA)> <!ELEMENT Categories ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required