Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 6331 © Leonidas Fegaras XML Schema 1 XML Schema Leonidas Fegaras.

Similar presentations


Presentation on theme: "CSE 6331 © Leonidas Fegaras XML Schema 1 XML Schema Leonidas Fegaras."— Presentation transcript:

1 CSE 6331 © Leonidas Fegaras XML Schema 1 XML Schema Leonidas Fegaras

2 CSE 6331 © Leonidas Fegaras XML Schema 2 XML Schema Replaced DTD Object-Oriented schemas Richer set of basic types Better ways of deriving new type declarations from old ones –type extension –type restriction Database-style key concept Uses namespaces Compatible with other standards

3 CSE 6331 © Leonidas Fegaras XML Schema 3 Base Types 1.string, float, double, decimal, boolean 2.timeDuration P10Y1M5T1H20M5S10years+1month+5days+1hour+20'+5'' 3.binary 4.uriReference 5.QName 6.ID, IDref A basic type may have properties, called facets –length, minLength, maxLength –minInclusive, maxInclusive, minExclusive, maxExclusive –enumerationfor string –patternfor string –encodingfor binary (eg, base64)

4 CSE 6331 © Leonidas Fegaras XML Schema 4 Predefined Derived Types Derived by restrictions on facets or multiplied in lists Other built-in derived types: –Name –int –long –short –byte –positiveInteger

5 CSE 6331 © Leonidas Fegaras XML Schema 5 Defining Simple Types Enumeration Range restriction Pattern List

6 CSE 6331 © Leonidas Fegaras XML Schema 6 Elements Example: It corresponds to the DTD:

7 CSE 6331 © Leonidas Fegaras XML Schema 7 Element Attributes Element attributes can only appear inside xsd:complexType in an xsd:element Keys can be defined using XPath expressions dept/person @ssn the selector defines the applicable elements the field defines the data that are unique withing the applicable elements xsd:unique may be used to define unique combination of values Foreign keys are like IDRefs, but well-typed dept/person @mother

8 CSE 6331 © Leonidas Fegaras XML Schema 8 Other Specifiers of xsd:element Other attributes of xsd:element –minOccurs: minimum number of occurrences default = '1' –maxOccurs: maximum number of occurrences default = '1'if minOccurs is not given default = '*'otherwise –optional is when minOccurs='0' and maxOccurs=‘1' –nullable = 'true' –ref = 'type-name' Other attributes of xsd:complexType –content = 'empty' –content = 'mixed' –content = 'elementOnly' –derivedBy = 'extension' –derivedBy = 'restriction'

9 CSE 6331 © Leonidas Fegaras XML Schema 9 xsd:complexType Any content Concatenation(A1, A2,..., An) A1 A2... An Alternation(A1 | A2 |... | An) A1 A2... An All but in any order(A1 & A2 &... & An) A1 A2... An

10 CSE 6331 © Leonidas Fegaras XML Schema 10 Using xsd:complexType

11 CSE 6331 © Leonidas Fegaras XML Schema 11 Reusing Types Extending types Restricting types

12 CSE 6331 © Leonidas Fegaras XML Schema 12 Using Schemas Schema “po.xsd”... Using targetNamespace: <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:po="http://lambda.uta.edu/PO" targetNamespace="http://lambda.uta.edu/PO">... XML data that conforms to this XML Schema:


Download ppt "CSE 6331 © Leonidas Fegaras XML Schema 1 XML Schema Leonidas Fegaras."

Similar presentations


Ads by Google