Attribute Type Declarations

The XML-Data package also supports attribute type declarations, and the types are the same as those for the XML DTD package. As was the case with ElementType declarations, the attribute is defined before the element definition and then an instance is included. It's possible to use the attribute in more than one element.

Recall the first XML file that you created, which included attributes. The listing was first used in Hour 6.

Listing 19.11 The DTD File That Defines the Email Message and Includes Qualifying Attributes
 1: <?xml version="1.0"?> 2: <!-- This file demonstrates the use of an attribute list to 3: qualify data. The filename is xmlhour7-5.xml --> 4: <!DOCTYPE E-MAIL [ 5: <!ELEMENT E-MAIL (TO+,FROM,CC*,BCC*,SUBJECT?,BODY?)> ...

Get Sams Teach Yourself XML in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.