unit11XMLSchema課件_第1頁
unit11XMLSchema課件_第2頁
unit11XMLSchema課件_第3頁
unit11XMLSchema課件_第4頁
unit11XMLSchema課件_第5頁
已閱讀5頁,還剩22頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

1、 Unit 11. XML Schema What This Unit About This unit will describe the use of the Xml Schema to define the syntax, structure and vocabulary that can be used within an XML document.What You Should Be Able to Do After completing this unit, you should be able to: Define a document element Describe attri

2、bute declarations Describe entity declarationsHow You Will Check Your Progress Accountability: Lab exercise Nov. 2000Unit 11. XML Schema References /TR/xmlschema-1/ XML Schema Part 1:Structures w3.ort/TR/xmlschema-2/ XML Schema Part 2:Datatypes Objectives Define a document element Describe ent

3、ity declarations Describe attribute declarationsNov. 2000Unit 11. XML SchemaWhat is a Schema? Next generation of DTDs Simple text file Can be a separate file Can be embedded within the XML file Nov. 2000 Unit 11. XML SchemaThe Root Element Hello,world! Goodbye,world! Nov. 2000 Unit 11. XML SchemaEle

4、ment Type Declaration Syntax: Allowed Element Contents For Example:An element declaration in the DTD and the corresponding tag in the XML document: Hello,world! Nov. 2000 Unit 11. XML SchemaDeclaring Child Elements Where one element will contain other elements. For Example: John smith Nov. 2000 Unit

5、 11. XML SchemaCompositor Compositor(sequence,choice,all)specifies required occurences. minOdccurr and maxOccur parameters specify the the minimum and maximum number of occurrences. Default is 1. Parameters are on elementTypeRef in compositor OR compositor itself to allow person to contain any numbe

6、r of fname/iname sequences where the Iname i s option,eg: Nov. 2000Unit 11. XML SchemaSchema Content Model ElementselementMeaningExampleDescriptionsequence“and” in specified orderTITLE and AUTHOR in that order choice“or”TITLE or AUTHORall“and” in any orderITLE and AUTHOR in any orderNov. 2000Schema

7、Content Model Elements (Cont) ElementMeaningExampleDescriptionminOccur=“0”“optional”,but no more than one is allowedTITLE element does not have to be present, but if it is, there can be no more than onemaxOccur=“*”minOccur=“0”element can be present in any number,including 0Any number(including 0)of

8、TITLE elements can be presentMaxOccur=“*”At last one of the element must be presentAt last one or more TITLE elements must be presentNov. 2000 Unit 11. XML SchemaContent Types Element content:Where an element contains only child elements. Compositor of elementReference Mixed content:Where an element

9、 may contain a mixture of text and additional child elements. elementType name=REVIEW Nov. 2000 Unit 11. XML SchemaDeclaring an Empty Element Syntax: eg:definition eg:XML Document Nov. 2000 Unit 11. XML SchemaIncluding Comments in a Declaration Syntax: eg: Nov. 2000 Unit 11. XML SchemaReferencing Sc

10、hema Declaration Schema file and XML file are always separate files: Filename:hello.xml Hello,world! Filename:greeting.xsr Nov. 2000 Unit 11. XML SchemaAttributes in an XML Document Example usage within an XML file: Why did the chicken cross the road? To get to the other side. Nov. 2000 Unit 11. XML

11、 SchemaDeclaring Attributes in a Schema Attribute-list declarations Syntax: attributeDefault attributeValue The attribute declaration is defined within the element or within an attribute Group. Nov. 2000Declaring Attributes in a Schema(Cont) The Schema declarations: Hardcover Paperback Hardcover Nov

12、. 2000Unit 11. XML SchemaAttribute TypesAttribute Type Description IDMust have unique values within the element.In the example below, TYPEID is of the ID type, and so requires unique values within the range of ROOK element.See Spot Run Jack and JillIDREF,IDREFSMust contain an ID valuestringCan conta

13、in any kind of character databooleanstring with two values,true or falseintegerMathematical concept of integer, no fixed maximum sizedecimalNumbers,including non-integer,with precision and scale 53.22realNumbers,including non-integer, with exponent 5.33E12datetimeSQL and ISO standards of data 2019-1

14、2-31binaryStrings of binary datauriUniform Resource identifier Reference as defined by IETFNov. 2000 Unit 11. XML SchemaAttributes Example The XML file: The Joys of Computing Nov. 2000 Unit 11. XML SchemaEntities Schema does not currently have any built-in entities. It is likely that the current XML

15、 1.0 built-in entities will be used. The five built-in entities in XML 1.0: - greater than“ -":quote -&apos:apostrophe -&ersand & Nov. 2000 Unit 11. XML Schema Declaring Entities Syntax: character sting represented For example: schema declaration: textEntity name=prodnameACME Calendar XML fil

16、e: -Thank you for choosing &prodname;as your primary scheduling program. When rendered by a user agent,the final text would read: -Thank you for choosing ACME Calendar as your primary scheduling program. Nov. 2000 Unit 11. XML SchemaParameter Entity Next Generation Parameter Entities in XML 1.0 will

17、 be replaced by: Attribute Groups-for grouping attribute definitions together. Model Groups-for grouping content model definitions together Archetypes-for group attribute definitions and model definitions together Nov. 2000 Unit 11. XML SchemaArchetypes Syntax: content type attribute specification w

18、here content type is datatypeRefcontent modelmodelGroupRef attribute specification is attrDeclattrGroupRef to refer to the archetype entity: Nov. 2000 Unit 11. XML SchemaArchetype-Example Nov. 2000 Unit 11. XML SchemaAttribute Groups Syntax: Attribute Declarations Example: . to refer to the attribute group: Nov. 2000 Unit 11. XML SchemaModel Groups Specify groups of element references Syntax: compositormodel group referenceelement reference to define and refer to the model group: . Nov. 2000 Unit 11. XML SchemaWhat We Didnt Cover Archetype refinement Schema Composition-Import/Expor

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論