Skip to Content
Real World XML
book

Real World XML

by Steven Holzner
January 2003
Beginner to intermediate content levelBeginner to intermediate
1200 pages
23h 42m
English
Peachpit Press
Content preview from Real World XML

Creating Document Type Definitions

To introduce DTDs, I'll start with a DTD that's internal to the document whose syntax it specifies (we'll see how to create external DTDs later in the chapter). In this case, the DTD itself goes inside the square brackets in the <!DOCTYPE> element (note that I've set the standalone attribute to yes here because this document does not rely on any external resources):

<?xml version = "1.0" standalone="yes"?> 
<!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)> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Inside XML

Inside XML

Steven Holzner
XML Hacks

XML Hacks

Michael Fitzgerald

Publisher Resources

ISBN: 0735712867Purchase book