tailieunhanh - XML Step by Step- P9

XML Step by Step- P9: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 | 138 XML Step by Step Relative URLs in XML documents work just like relative URLs in HTML pages. For more details on exactly how they work see Using an External DTD Subset Only on page 121. The entity file contains the entity s replacement text which can include only items that can legally be inserted into an element character data nested elements and so on as described in Types of Content in an Element on page 54 . As you ll learn later in this chapter you can ultimately insert a general external parsed entity only within an element s content and not within an attribute s value. note In a general external parsed entity file you can optionally include a text declaration in addition to the entity s replacement text. The text declaration must come at the very beginning of the file. For information see the sidebar Characters Encoding and Languages on page 77. As an example the following DTD defines the external file as a general external parsed entity DOCTYPE ARTICLE ELEMENT ARTICLE TITLEPAGE INTRODUCTION SECTION ELEMENT TITLEPAGE PCDATA ELEMENT INTRODUCTION ANY ELEMENT SECTION PCDATA ELEMENT HEADING PCDATA ENTITY topics SYSTEM Here are the contents of the file HEADING Topics HEADING The Need for XML The Official Goals of XML Standard XML Applications Real-World Uses for XML Chapter 6 Defining and Using Entities 139 This particular external entity file contains two of the items that you can include in an XML element a nested element and a block of character data. Its contents can be validly inserted within an INTRODUCTION element which can have any type of content as shown in this example INTRODUCTION Here s what this article covers topics INTRODUCTION The XML processor will replace the entity reference topics with the replacement text from the external entity file and process the text just as if you had typed it into the document at the position of the reference like this INTRODUCTION Here s what this article covers HEADING Topics .

TỪ KHÓA LIÊN QUAN