Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to XML Schema CSCI 7818 by Ming Rutar.

Similar presentations


Presentation on theme: "An Introduction to XML Schema CSCI 7818 by Ming Rutar."— Presentation transcript:

1 An Introduction to XML Schema CSCI 7818 by Ming Rutar

2 Resources XML Schema is a W3C Recommendation http://www.w3.org/XML/Schema

3 Motivation Purpose of DTD : Sharing grammar/data with others Validation by the parser Defaulting of values. Shortcomings of DTD a very limited capability for specifying datatypes. incompatible set of datatypes with those found in databases inconsistent syntax with XML

4 XML Schema Requirements Structural Schemas Besides analogizing DTD, there are specific goals beyond DTD: Integration with namespace Definition of incomplete constraints on content of an element type Integration of structural schemas with primitive data types inheritance

5 XML Schema Requirements (2) Primitive Data Typing Based on experience with SQL, Java primitives. Conformance Define the relation of schemata to XML document instances, and obligations on schema-aware processors.

6 Example (DTD) BookStore.dtd

7 Example (Schema) <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.books.org" xmlns="http://www.books.org" elementFormDefault="qualified">

8 Example (vocabulary) DTDBookStoreSchema ELEMENT #PCDATA ATTLIST ID NMTOKEN CDATA ENTITY BookStore Book Title Author Date ISBN Publisher complexType element sequence schema string boolean integer

9 Data Types A complex types allow elements in their content and may carry attributes A simple types cannot have element content and cannot carry attributes, such integer. A ur-type definition is present in each ·XML Schema·, serving as the root of the type definition hierarchy for that schema. Primitive datatypes are those that are not defined in terms of other datatypes Derived datatypes are those that are defined in terms of other datatypes.

10

11 Mapping between DTD and Schema http://ucsu.colorado.edu/~rutar/map_between_dtd_and_schema.ht m

12 An Instance Document <BookStore xmlns =http://www.books.org-1http://www.books.org xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance-2http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation="http://www.books.org BookStore.xsd">-3 My Life and Times Paul McCartney July, 1998 94303-12021-43892 McMillin Publishing...

13 Multiple Level Checking Validator BookStore.XML BookStore.xsd XMLSchema.xsd

14 Other way to define name space Make xsd as default namespace http://ucsu.colorado.edu/~rutar/BookStore_bk.htm Compare with http://ucsu.colorado.edu/~rutar/BookStore_xsd.htm

15 Conclusion XML Schemas are a tremendous advancement over DTDs XML Schemas are much more complex than DTDs


Download ppt "An Introduction to XML Schema CSCI 7818 by Ming Rutar."

Similar presentations


Ads by Google