Embedding Multiple Unparsed Entities in a Document

Embedding multiple unparsed entities is no problem. Just create an attribute of the ENTITIES type and assign multiple entities to it, like this:

 <?xml version = "1.0" standalone="no"?>  <!DOCTYPE DOCUMENT [ <!ELEMENT DOCUMENT (CUSTOMER)*> <!ELEMENT CUSTOMER (NAME,DATE,ORDERS)> <!ELEMENT NAME (LAST_NAME,FIRST_NAME)> <!ELEMENT LAST_NAME (#PCDATA)> <!ELEMENT FIRST_NAME (#PCDATA)> <!ELEMENT DATE (#PCDATA)> <!ELEMENT ORDERS (ITEM)*> <!ELEMENT ITEM (PRODUCT,NUMBER,PRICE)> <!ELEMENT PRODUCT (#PCDATA)> <!ELEMENT NUMBER (#PCDATA)> <!ELEMENT PRICE (#PCDATA)>  <!NOTATION GIF SYSTEM "image/gif">   <!ATTLIST CUSTOMER   IMAGES ENTITIES #IMPLIED>   <!ENTITY SNAPSHOT1 SYSTEM "image.gif" NDATA GIF>   <!ENTITY SNAPSHOT2 SYSTEM "image2.gif" NDATA GIF>   <!ENTITY SNAPSHOT3 SYSTEM "image3.gif" NDATA GIF>  ]> <DOCUMENT>  <CUSTOMER IMAGES="SNAPSHOT1 SNAPSHOT2 SNAPSHOT3">  .         .         .     </CUSTOMER> </DOCUMENT> 

That's it all it takes. And that's it for our coverage of constructing and using DTDs as well. In this chapter and the previous chapter, we've seen what goes into a DTD and how to handle elements, attributes, entities, and notations. In the next chapter, we'll take a look at the proposed alternate way of declaring those items in XML documents: XML schemas.



Real World XML
Real World XML (2nd Edition)
ISBN: 0735712867
EAN: 2147483647
Year: 2005
Pages: 440
Authors: Steve Holzner

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