21.2 Annotated Sample Documents

     

These examples are intended as a mnemonic aid for XML syntax and as a quick map from a specific instance of an XML language construct to its corresponding XML syntax reference section. The sample document and DTD incorporate features defined in the XML 1.0 and Namespaces in XML recommendations.

The sample XML application describes the construction of a piece of furniture. Within the figures, each distinct language construct is enclosed in a box, with the relevant reference section name provided as a callout. By locating a construct in the sample, then locating the associated reference section, you can quickly recognize and learn about unfamiliar XML syntax. Four files make up this sample application:


bookcase .xml

The document shown in Figure 21-1 uses furniture.dtd to describe a simple bookcase.

Figure 21-1. bookcase.xml
figs/xian3_2101.gif


furniture.dtd

The XML document type definition shown in Figure 21-2 provides a simple grammar for describing components and assembly details for a piece of furniture.

Figure 21-2. furniture.dtd
figs/xian3_2102.gif


bookcase_ex.ent

The external entity file shown in Figure 21-3 contains additional bookcase-specific elements for the bookcase.xml document.

Figure 21-3. bookcase_ex.ent
figs/xian3_2103.gif


parts_list.ent

Figure 21-4 contains an external parsed general entity example that contains the parts list for the bookcase example document.

Figure 21-4. parts_list.ent
figs/xian3_2104.gif



XML in a Nutshell
XML in a Nutshell, Third Edition
ISBN: 0596007647
EAN: 2147483647
Year: 2003
Pages: 232

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net