Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 34 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
34
Dung lượng
277 KB
Nội dung
XML DTD and NamespacesChapter 2
Core XML / Chapter 2 / Slide 2 of 25Review-1A markup language defines a set of rules that adds meaning to the content and structure of documents XML is extensible, which means that we can define our own set of tags, and make it possible for other parties (people or programs) to know and understand these tags. This makes XML much more flexible than HTMLXML inherits features from SGML and includes the features of HTML. XML can be generated from existing databases using a scalable three-tier model. XML-based data does not contain information about how data should be displayedAn XML document is composed of a set of “entities” identified by unique names
Core XML / Chapter 2 / Slide 3 of 25Review-2A well-formed document is one that conforms to the basic rules of XML; a valid document is a well-formed document that conforms to the rules of a DTD (Document Type Definition)The parser helps the computer to interpret an XML fileSteps involved in the building of an XML document are:Stating an XML declarationCreating a root elementCreating the XML codeVerifying the documentCharacter data is classified into PCDATA and CDATA
Core XML / Chapter 2 / Slide 4 of 25Review-3Entities are used to avoid typing long pieces of text repeatedly in a document. The two types of entities are:General entities Parameter entitiesThe <!DOCTYPE […]> declaration follows the XML declaration in an XML document.An attribute gives information about an element
Core XML / Chapter 2 / Slide 5 of 25Chapter ObjectivesExplain Document Type DefinitionCreate Document Type Definitions:Declaring an ElementDeclaring AttributesExplain the use of DTDDescribe namespaces
Core XML / Chapter 2 / Slide 6 of 25Document Type Definition (DTD) It is a feature of SGML, which is inherited by XML.It contains the list of tags that specifies the grammatical structure of an XML document.DTD defines the way elements relate to one another within the document’s tree structure, and specifies the attributes. DTD are of two types:An external DTDAn internal DTD
Core XML / Chapter 2 / Slide 7 of 25Why Use a DTDDTDs are used by XML to provide an application independent way of sharing data.Common DTD can be used to interchange data between independent groups of people.DTD can be used by the application to verify that valid data has been entered.It defines the legal building blocks of an XML document.
Core XML / Chapter 2 / Slide 8 of 25Structure of a DTD<!DOCTYPE dtd-name[<!ELEMENT element-name (element-content type) ><!ATTLIST element-name attribute-name attribute-type default-value>]>DOCTYPE declarationELEMENT declarationATTRIBUTE declaration
Core XML / Chapter 2 / Slide 9 of 25Declaring an ElementXML elements are declared with an element declaration.Syntax<!ELEMENT element-name (element-content type)>Example<!ELEMENT SHOWROOM (TV|LAPTOP)+>
Core XML / Chapter 2 / Slide 10 of 25Empty ElementEMPTY element-content type specifies that the element has no child elements or character data.Syntax <!ELEMENT element-name (EMPTY)>Example <!ELEMENT img (EMPTY)>Empty elements with attributes are possible: <img src=“Tittle.gif”></img>
123doc.vn