TAILIEUCHUNG - XML Step by Step- P22

XML Step by Step- P22:Extensible Markup Language, or XML, is currently the most promising language for storing and exchanging information on the World Wide Web. Although Hypertext Markup Language (HTML) is presently the most common language used to create Web pages, HTML has a limited capacity for storing information. In contrast, because XML allows you to create your own elements, attributes, and document structure, you can use it to describe virtually any kind of information from a simple recipe to a complex database | 388 XML Step by Step Accessing XML Entities and Notations As I explained in Chapter 6 you use an unparsed entity declaration to incorporate an external data file into an XML document. All unparsed entities are of the general external type. The way you use an unparsed entity is to assign its name to an attribute that has the ENTITY or ENTITIES type as a means of associating the external entity file with a particular XML element. The XML processor doesn t access an unparsed entity file. Rather it merely makes the description of the entity and its notation available to the application which can obtain and use the information appropriately. This section presents an XML document and an HTML page that demonstrate the basic steps for using the DOM to extract from an XML document the information on an entity as well as the notation that describes the entity s format. Listing 11-7 contains the example XML document and Listing 11-8 contains the example HTML page. You ll find copies of these two listings on the companion CD under the filenames Inventory and Inventory . Inventory xml version -- File Name Inventory -- DOCTYPE INVENTORY NOTATION TXT SYSTEM plain text file ENTITY rev_huck SYSTEM Review of Huckleberry NDATA TXT ENTITY rev_leaves SYSTEM Review of Leaves of NDATA TXT ENTITY rev_legend SYSTEM Review of Sleepy NDATA TXT ELEMENT INVENTORY BOOK ELEMENT BOOK TITLE AUTHOR BINDING PAGES PRICE ATTLIST BOOK Review ENTITY IMPLIED ELEMENT TITLE PCDATA ELEMENT AUTHOR PCDATA ELEMENT BINDING PCDATA ELEMENT PAGES PCDATA ELEMENT PRICE PCDATA Chapter 11 Displaying XML Documents Using Document Object Model Scripts 389 INVENTORY BOOK Review rev_huck TITLE The Adventures of Huckleberry Finn TITLE AUTHOR Mark Twain AUTHOR BINDING mass market paperback BINDING PAGES 298 PAGES PRICE PRICE BOOK BOOK Review rev_leaves TITLE Leaves of Grass TITLE AUTHOR Walt Whitman AUTHOR BINDING hardcover BINDING PAGES 462 .