tailieunhanh - XML Step by Step- P8

XML Step by Step- P8:Extensible Markup Language, or XML, is currently the most promising language for storing and exchanging information on the World Wide Web. Although Hypertext Markup Language (HTML) is presently the most common language used to create Web pages, HTML has a limited capacity for storing information. In contrast, because XML allows you to create your own elements, attributes, and document structure, you can use it to describe virtually any kind of information from a simple recipe to a complex database | Chapter 5 Creating Valid XML Documents Using Document Type Definitions 115 FILM Class instructional TITLE The Use and Care of XML TITLE INSTRUCTOR Michael J. Young INSTRUCTOR FILM If you omitted the Class attribute it would be assigned the default value fictional. Assigning to Class a value other than fictional documentary or instructional would be a validity error. The keyword NOTATION followed by space followed by an open parenthesis followed by a list of notation names separated with characters followed by a close parenthesis. Each of these names must exactly match the name of a notation declared in the DTD. A notation describes a data format or identifies the program used to process a particular format. I ll discuss notations in Chapter 6. note You cannot declare more than one NOTATION type attribute for a given element. Also you cannot declare a NOTATION type attribute for an element that is declared as EMPTY. For example assuming that the notations HTML SGML and RTF are declared in your DTD you could restrict the values of the Format attribute to one of these notation names by declaring it like this ELEMENT EXAMPLE_DOCUMENT PCDATA ATTLIST EXAMPLE_DOCUMENT Format NOTATION HTML SGML RTF REQUIRED You could then use the Format element to indicate the format of a particular EXAMPLE_DOCUMENT element as in this example EXAMPLE_DOCUMENT Format HTML CDATA HTML HEAD TITLE Mike s Home Page TITLE HEAD BODY P Welcome P BODY Document Type Definitions 5 116 XML Step by Step HTML EXAMPLE_DOCUMENT Assigning Format a value other than HTML SGML or RTF would be a validity error. Notice the use of the CDATA section here which allows you to use the left angle bracket character freely within the element s character data. The Default Declaration The default declaration is the third and final required component of an attribute definition. It specifies whether the attribute is required and if the attribute isn t required it indicates what the processor should do if the attribute is .

TỪ KHÓA LIÊN QUAN