Основы XML




Пример 6.1


<?xml version="1.0"?> <!--Имя файла: Inventory Valid Entity.xml --> <!DOCTYPE INVENTORY [ <!-- примитивы для присвоения значений элементу BINDING: --> <!ENTITY mass "mass market paperback"> <!ENTITY trade "trade paperback"> <!ENTITY hard "hardcover">

<!-- внешние примитивы, содержащие обзоры --> <!-- они будут присвоены атрибуту Review элементов BOOK --> <!NOTATION DOC SYSTEM "Microsoft Word document"> <!NOTATION TXT SYSTEM "plain text file"> <!ENTITY rev_leaves SYSTEM "Review of Leaves of Grass.doc" NDATA DOC> <!ENTITY rev_faun1 SYSTEM "Review 01 of The Marble Faun.doc" NDATA DOC> <!ENTITY rev_faun2 SYSTEM "Review 02 of The Marble Faun.txt" NDATA TXT> <!ENTITY rev_screw SYSTEM "Review of The Turn of the Screw.txt" NDATA TXT> <!ELEMENT INVENTORY (BOOK)*> <!ELEMENT BOOK (TITLE, AUTHOR, BINDING, PAGES, PRICE)> <!ATTLIST BOOK InStock (yes|no) #REQUIRED Reviews ENTITIES #IMPLIED> <!ELEMENT TITLE (#PCDATA | SUBTITLE)*> <!ELEMENT SUBTITLE (#PCDATA)> <!ELEMENT AUTHOR (#PCDATA)> <!ATTLIST AUTHOR Born CDATA #IMPLIED> <!ELEMENT BINDING (#PCDATA)> <!ELEMENT PAGES (#PCDATA)> <!ELEMENT PRICE (#PCDATA)> ] > <INVENTORY> <BOOK InStock="yes"> <TITLE>The Adventures of Huckleberry Finn</TITLE> <AUTHOR Born="1835">Mark Twain</AUTHOR> <BINDING>&mass;</BINDING> <PAGES>298</PAGES> <PRICE>$5.49</PRICE> </BOOK> <BOOK InStock="no" Reviews="rev_leaves"> <TITLE>Leaves of Grass</TITLE> <AUTHOR Born="1819">Walt Whitman</AUTHOR> <BINDING>&hard;</BINDING> <PAGES>462</PAGES> <PRICE>$7.75</PRICE> </BOOK> <BOOK InStock="yes"> <TITLE>The Legend of Sleepy Hollow</TITLE> <AUTHOR>Washington Irving</AUTHOR> <BINDING>&mass;</BINDING> <PAGES>98</PAGES> <PRICE>$2.95</PRICE> </BOOK> <BOOK InStock="yes" Reviews="rev_faun1 rev_faun2"> <TITLE>The Marble Faun</TITLE> <AUTHOR Born="1804">Nathaniel Hawthorne</AUTHOR> <BINDING>&trade;</BINDING> <PAGES>473</PAGES> <PRICE>$10.95</PRICE> </BOOK> <BOOK InStock="no"> <TITLE>Moby-Dick <SUBTITLE>Or, the Whale</SUBTITLE> </TITLE> <AUTHOR Born="1819">Herman Melville</AUTHOR> <BINDING>&hard;</BINDING> <PAGES>724</PAGES> <PRICE>$9.95</PRICE> </BOOK> <BOOK InStock="yes"> <TITLE>The Portrait of a Lady</TITLE> <AUTHOR>Henry James</AUTHOR> <BINDING>&mass;</BINDING> <PAGES>256</PAGES> <PRICE>$4.95</PRICE> </BOOK> <BOOK InStock="yes"> <TITLE>The Scarlet Letter</TITLE> <AUTHOR>Nathaniel Hawthorne</AUTHOR> <BINDING>&trade;</BINDING> <PAGES>253</PAGES> <PRICE>$4.25</PRICE> </BOOK> <BOOK InStock="no" Reviews="rev_screw"> <TITLE>The Turn of the Screw</TITLE> <AUTHOR>Henry James</AUTHOR> <BINDING>&trade;</BINDING> <PAGES>384</PAGES> <PRICE>$3.35</PRICE> </BOOK> </INVENTORY>

Листинг 6.1. Inventory Valid Entity.xml

Закрыть окно




Содержание  Назад  Вперед