Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 636 Data Integration XML Schema. 2 XML Schemas W3C Recommendation: Generalizes DTDs Uses XML syntax Two documents: structure.

Similar presentations


Presentation on theme: "CSE 636 Data Integration XML Schema. 2 XML Schemas W3C Recommendation: Generalizes DTDs Uses XML syntax Two documents: structure."— Presentation transcript:

1 CSE 636 Data Integration XML Schema

2 2 XML Schemas W3C Recommendation: http://www.w3.org/XML/Schema Generalizes DTDs Uses XML syntax Two documents: structure and datatypes –http://www.w3.org/TR/xmlschema-1 –http://www.w3.org/TR/xmlschema-2 XML-Schema is very complex –often criticized –some alternative proposals

3 3 XML Schemas DTD:

4 4 XML Namespaces … 15 …. … 15 …. http://www.w3.org/TR/REC-xml-names (1/99) Solve the problem of tag name conflicts name ::= [prefix:]localpart

5 5 … … XML Namespaces Syntactic:, Semantic: provide URL for schema defined here

6 6 Elements vs. Types in XML Schema DTD:

7 7 Elements vs. Types in XML Schema Types: –Simple types (integers, strings,...) –Complex types (regular expressions, like in DTDs) Element-type-element alternation: –Root element has a complex type –That type is a regular expression of elements –Those elements have their complex types... –... –On the leaves we have simple types

8 8 Global types: can be reused in other elements Local vs. Global Types in XML Schema Local type: [define locally the person’s type] Global type: [define here the type pType]

9 9 Local vs. Global Elements in XML Schema Global elements: like in DTDs Local element:... Global element:...

10 10 Regular Expressions in XML Schema Recall the element-type-element alternation: [regular expression on elements] Regular expressions: A B C = A B C A B C = A | B | C A B C = (A B C) <xsd:… minOccurs=“0” maxOccurs=“unbounded”>… = (...)* <xsd:… minOccurs=“0” maxOccurs=“1”>… = (...)?

11 11 Local Names in XML Schema … … … … … … name has different meanings in person and in product

12 12 Subtle Use of Local Names Arbitrary deep binary tree with A elements, and a single B element

13 13 Attributes in XML Schema … … Attributes are associated to the type, not to the element Only to complex types More trouble if we want to add attributes to simple types

14 14 Adding Attributes to Simple Types

15 15 “Mixed” Content, “Any” Type Better than in DTDs: can still enforce the type, but now may have text between any elements Means anything is permitted there …

16 16 “All” Group Restrictions: –Only at top level –Has only elements –Each element occurs at most once E.g. “comment” occurs 0 or 1 times

17 17 Derived Types by Extensions Corresponds to inheritance

18 18 Derived Types by Restrictions may restrict cardinalities, e.g. (0,infty) to (1,1) may restrict choices other restrictions… Corresponds to set inclusion … [rewrite the entire content, with restrictions]…

19 19 Simple Types string token byte unsignedByte integer positiveInteger int –larger than integer unsignedInt long short... time dateTime duration date ID IDREF IDREFS

20 20 Facets of Simple Types Examples length minLength maxLength pattern enumeration whiteSpace maxInclusive maxExclusive minInclusive minExclusive totalDigits fractionDigits Facets = additional properties restricting a simple type 15 facets defined by XML Schema

21 21 Facets of Simple Types Can further restrict a simple type by changing some facets Restriction = subset

22 22 List types: Union types Restriction types Not so Simple Types 20003 15037 95977 95945

23 23 Summary of XML Schema Formal Expressive Power: –Can express precisely the regular tree languages (over unranked trees) Lots of other stuff –Some form of inheritance –A “null” value –Large collection of data types

24 24 References Lecture Slides –Dan Suciu –http://www.cs.washington.edu/homes/suciu/COURSES/590DS/1 2xmlschema.htmhttp://www.cs.washington.edu/homes/suciu/COURSES/590DS/1 2xmlschema.htm BRICS XML Tutorial –A. Moeller, M. Schwartzbach –http://www.brics.dk/~amoeller/XML/index.htmlhttp://www.brics.dk/~amoeller/XML/index.html W3C's XML Schema homepage –http://www.w3.org/XML/Schemahttp://www.w3.org/XML/Schema XML School –http://www.w3schools.comhttp://www.w3schools.com


Download ppt "CSE 636 Data Integration XML Schema. 2 XML Schemas W3C Recommendation: Generalizes DTDs Uses XML syntax Two documents: structure."

Similar presentations


Ads by Google