1. Trang chủ
  2. » Tất cả

TP2

34 107 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

XML DTD and NamespacesChapter 2 Core XML / Chapter 2 / Slide 2 of 25Review-1A 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 HTMLXML 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 displayedAn XML document is composed of a set of “entities” identified by unique names Core XML / Chapter 2 / Slide 3 of 25Review-2A 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 fileSteps involved in the building of an XML document are:Stating an XML declarationCreating a root elementCreating the XML codeVerifying the documentCharacter data is classified into PCDATA and CDATA Core XML / Chapter 2 / Slide 4 of 25Review-3Entities are used to avoid typing long pieces of text repeatedly in a document. The two types of entities are:General entities Parameter entitiesThe <!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 ObjectivesExplain Document Type DefinitionCreate Document Type Definitions:Declaring an ElementDeclaring AttributesExplain the use of DTDDescribe 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 DTDAn internal DTD Core XML / Chapter 2 / Slide 7 of 25Why Use a DTDDTDs 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 ElementXML 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 ElementEMPTY 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

Ngày đăng: 12/01/2013, 15:43

Xem thêm

w