tailieunhanh - XML Step by Step- P5
XML Step by Step- P5: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 3 Creating Well-Formed XML Documents 55 Here s an example of content in an element that consists of both character data and a nested element Content of TITLE element r----------------------1------------------------ TITLE Moby-Dick SUBTITLE Or The b hale SUBTITLEX TITLE 1 I 11---------------------T -------------------1 Character data Nested element When adding character data to an element you can insert any characters as part of the character data except the left angle bracket the ampersand or the string . note The XML parser scans an element s character data looking for XML markup. You therefore cannot insert a left angle bracket an ampersand or the string as a part of the character data because the parser would interpret each of these characters or strings as markup or the start of markup. If you want to insert or as an integral part of the character data you can use a CDATA section discussed later in the list . You can also insert or any other character including one not on your keyboard by using a character reference and you can insert certain characters by using predefined general entity references such as lt or amp for inserting or . General entity and character references are discussed next. Well-Formed Documents 3 General entity references or character references. Here s an element containing one of each A general entity reference TITLEPAGE Author author 1 Document Name How to Enter the 60 Character TITLEPAGE 1 1 A character reference Entity and character references are covered in Chapter 6. CDATA sections. A CDATA section is a block of text in which you can freely insert any characters except the string . Here s an example of a CDATA section in an element 56 XML Step by Step A CDATA section TITLEPAGE Author Mike CDATA Document Name How to Enter the and 2 Characters _ TITLEPAGE CDATA sections are covered in Chapter 4. Processing instructions. A processing instruction provides information to the XML application. Processing instructions are covered in
đang nạp các trang xem trước