
Professional PHP Programming phần 5
Thông tin tài liệu:
Nội dung trích xuất từ tài liệu:
Professional PHP Programming phần 5Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com H owever, as we noted above, there is also an alternative syntax, whereby we place the closing slash at the end of the opening element: T he following line defines an empty element i mage , with an attribute s rc w ith the value l ogo.gif : Processing Instructions X ML processing instructions contain information for the application using the XML document. Processing instructions do not constitute the part of the character data of the document – the XML parser should pass these instructions unchanged to the application. The syntax of the processing instruction might be strangely familiar to you: I n the following example, p hp i s the target application and p rint This XML document was created on Jan-07, 1999; i s the instruction: Entity References E ntities are used in the document as a way of avoiding typing long pieces of text many times in a document. Entities are declared in the documents DTD (we will see later how to declare entities, when we look at DTDs in more detail). The declared entities can be referenced throughout the document. When the document is parsed by an XML parser, it replaces the entity reference with the text defined in the entity declaration. There are two types of entities – internal and external. The replacement text for an internal entity is specified in an entity declaration, whereas the replacement text for an external entity resides in a separate file, the location of which is specified in the entity declaration. After the entity has been declared, it can be referenced within the document using the following syntax: &nameofentity; N ote that there should be no space between the ampersand ( & ), the entity name and the semicolon. For example, lets assume that an entity m yname w ith the value Harish Rawat h as been declared in the DTD of the document. The entity m yname c an be referred to in the document as: TEAM FLY PRESENTSSimpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com &myname; T he parser, while parsing the document will replace & myname ; b y H arish Rawat . So the application using the XML document will see the content of the element author as H arish Rawat . Comments C omments can be added in XML documents; the syntax is identical to that for HTML comments: The Document Type Definition T he document type definition of an XML document is defined within a declaration known as the d ocument type declaration . The DTD can be contained within this declaration, or the declaration can point to an external document containing the DTD. The DTD consists of element type declarations, attribute list declarations, entity declarations, and notation declarations. We will cover all of these in this section. B e sure to distinguish between the document type d efinition , or DTD, and the d ocument type d eclaration . T he syntax for a document type definition is: T he r ootelementname i s the name of the root element of the document. The declarations for the various elements, attributes, etc., are placed within the square braces. An XML document can also have an external DTD, which can be referenced with the following syntax: T he r ootelementname i s the name of the root element of the document. The location of the file containing the DTD is h ttp://www.harawat.com/books.dtd . Element Type Declarations T he element type declaration indicates whether the element contains other elements, text, or is empty. It also specifies whether the elements are mandatory or optional, and how many times the elements can appear. An element type declaration, specifying that an element can contain character data, looks as follows: TEAM FLY PRESENTSSimpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com H ere E LEMENT i s a keyword, e lementname i s the name of the element, and # PCDATA i s also a keyword. # PCDATA s tands for parsed character data, that is, the data that can be handled by the XML parser. For example, the following element declaration specifies that the element t itle c ontains character data: T he syntax of an element type declaration for an empty element is: H ere e lementname i s the name of the element, and E MPTY i s a keyword. For example, the following element type declaration specifies that element i mage i s empty: T he syntax of an element type declaration for an element can contain anything – other elements or parsed character data – is as follows: H ere e lementname i s the name of the element and A NY i s a keyword. An element type declaration for an element that contains only other elements looks like this: H ere the element p arentelement c ontains the child elements c hildelement1 , c hildelement2 , etc. For example, the following element type declaration specifies that the element b ook c ontains the elements t itle , a uthors , i sbn , p rice : T he syntax of element type declaration, specifying that p arentelemnt c ontains ...
Tìm kiếm theo từ khóa liên quan:
lập trình windows ứng dụng windows tìm hiểu windows lập trình ứng dụng lập trình phần mềm lập trình hệ thống lập trình dotNet lập trình Java lập trình PHPTài liệu có liên quan:
-
Mô tả công việc lập trình viên phần mềm
1 trang 229 0 0 -
Bài tập lập trình Windows dùng C# - Bài thực hành
13 trang 203 0 0 -
Bài giảng Công nghệ phần mềm - Chương 2: Quy trình xây dựng phần mềm
36 trang 181 0 0 -
Đề cương môn học Phân tích thiết kế phần mềm
143 trang 178 0 0 -
bảo mật mạng các phương thức giả mạo địa chỉ IP fake IP
13 trang 166 0 0 -
Luận văn : Xây dựng chương trình sắp xếp lịch trực bác sĩ
61 trang 161 0 0 -
Luận văn: Nghiên cứu kỹ thuật giấu tin trong ảnh Gif
33 trang 157 0 0 -
Đồ án tốt nghiệp: Bảng LED ma trận điều khiển bằng ứng dụng Android
102 trang 147 0 0 -
Giáo trình Lập trình Android cơ bản: Phần 1
190 trang 138 0 0 -
[Thảo luận] Học PHP như thế nào khi bạn chưa biết gì về lập trình?
5 trang 136 0 0 -
Excel add in development in c and c phần 9
0 trang 123 0 0 -
information technology outsourcing transactions process strategies and contracts 2nd ed phần 3
65 trang 115 0 0 -
LUẬN VĂN: Tìm hiểu kỹ thuật tạo bóng cứng trong đồ họa 3D
41 trang 114 0 0 -
Program C Ansi Programming Embedded Systems in C and C++ phần 4
12 trang 103 0 0 -
Giáo trình Lập trình Windows 1 - Trường CĐN Đà Lạt
117 trang 102 0 0 -
Giáo trình môn kỹ thuật vi điều khiển
0 trang 100 0 0 -
Bài thu hoạch cá nhân môn Quản trị dự án phần mềm
75 trang 97 0 0 -
81 trang 92 0 0
-
265 trang 91 0 0
-
Bài giảng Lập trình trên Windows: Chương 1 - Trần Minh Thái
68 trang 89 0 0