Presentation is loading. Please wait.

Presentation is loading. Please wait.

2/9/00 EECS 684: Current Topics in Databases1 ( W3C Working Draft 17 December 1999 )

Similar presentations


Presentation on theme: "2/9/00 EECS 684: Current Topics in Databases1 ( W3C Working Draft 17 December 1999 )"— Presentation transcript:

1 2/9/00 EECS 684: Current Topics in Databases1 http://www.w3.org/TR/xmlschema-1 http://www.w3.org/TR/xmlschema-2 ( W3C Working Draft 17 December 1999 ) http://msdn.microsoft.com/xml/xmlguide/ schema-overview.asp XML Schema

2 2/9/00 EECS 684: Current Topics in Databases2 Outline Introduction to XML Schema Defining Elements and Attributes Content Model Data Types Extensibility

3 2/9/00 EECS 684: Current Topics in Databases3 Introduction An XML Schema specifies the structure of an XML document and constrains on its content Unlike DTD, XML Schema uses XML syntax An XML Schema is useful for data validation data interchange

4 2/9/00 EECS 684: Current Topics in Databases4 An XML Document Alice Smith 12 Maple Street Ann Arbor MI A good customer

5 2/9/00 EECS 684: Current Topics in Databases5 Defining & Using Types

6 2/9/00 EECS 684: Current Topics in Databases6 Content Model Content minOccurs and maxOccurs Order Group

7 2/9/00 EECS 684: Current Topics in Databases7 Content An element can contain text, other elements, a mixture of text and elements, or nothing at all Use the content attribute Possible values are “textOnly”, “elementOnly”, “mixed”, and “empty” An example

8 2/9/00 EECS 684: Current Topics in Databases8 minOccurs and maxOccurs Specify how many times an element can appear within another element Use the minOccurs attribute Use the maxOccurs attribute

9 2/9/00 EECS 684: Current Topics in Databases9 Order Specify whether sub-elements are required to appear in a certain order, and if only one sub-element can appear Use the order attribute Possible values are “seq”, “choice”, and “all”

10 2/9/00 EECS 684: Current Topics in Databases10 Group Specify constraints on a specific set of sub- elements Accept order, minOccurs, and maxOccurs attributes

11 2/9/00 EECS 684: Current Topics in Databases11 Data Types Unlike DTD, XML Schema allows you to specify a data type for an element or an attribute Data types indicate the format of data Data types categorization atomic vs. aggregate data types primitive vs. generated data types built-in vs. user-generated data types

12 2/9/00 EECS 684: Current Topics in Databases12 Defining Data Types Defining “i4” (signed 4-byte integer) from the built-in data type integer minInclusive and maxInclusive facets specify the bounds of the values

13 2/9/00 EECS 684: Current Topics in Databases13 Defining Data Types (Cont.) Defining “amount” <datatype name = “amount” source =“decimal”> Use precision and scale facets to constrain the range of the base type.

14 2/9/00 EECS 684: Current Topics in Databases14 Defining Data Types (Cont.) Defining a data type which limit the values of dates to the three US holidays enumeration facet constrains the value space of the data type to the specified list.

15 2/9/00 EECS 684: Current Topics in Databases15 Referencing Other Schemas The namespace declaration begins with “xmlns:” followed by a “prefix” then the URI of the other schema Example <type name = “shipTo” xmlns:abcde=“http://ecommerce.com/a.xml”>

16 2/9/00 EECS 684: Current Topics in Databases16 Conclusion XML Schema allows you to define types for elements and attributes build a content model define your own data types refer to other schemas


Download ppt "2/9/00 EECS 684: Current Topics in Databases1 ( W3C Working Draft 17 December 1999 )"

Similar presentations


Ads by Google