Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML and Databases Exercise Session 3 (courtesy of Ghislain Fourny/ETH)

Similar presentations


Presentation on theme: "XML and Databases Exercise Session 3 (courtesy of Ghislain Fourny/ETH)"— Presentation transcript:

1 XML and Databases Exercise Session 3 (courtesy of Ghislain Fourny/ETH)

2 Department of Computer Science Good to know: XML Schema types Simple type - predefined or user-defined - element or attribute type Complex type - user-defined - element type only Empty content Simple content Complex content Mixed content 2

3 Department of Computer Science Good to know: XML Schema types Types (can) have QNames: All predefined types User-defined types (here simple) 3 Tags, attributes... XML Schema looks like XML... that's because it is XML!

4 Department of Computer Science Good to know: XML Schema types They can also be anonymous. 4 Anonymous types can be defined under any xs:element or xs:attribute. Non- anonymous types have a global scope and must be defined directly under xs:schema.

5 Department of Computer Science Complex types in XML Schema Complex type, complex content 5

6 Department of Computer Science Complex types in XML Schema Simple content (here anonymous) 6

7 Department of Computer Science Complex types in XML Schema Empty content Simple content restricted to "" Or a complex content without any children Mixed content As in complex content, with an additional attribute mixed set to true in xs:complexType 7

8 Department of Computer Science Exercises 1-3 Passenger Flight Airport Booking 8

9 Department of Computer Science Exercises 1-3 Passenger: name, address, passport number Flight: ID, number of seats, date, origin, dest Airport: name, code, tax value Booking: credit card, flight, passenger 9

10 Department of Computer Science Exercise 1: XML Data Sample data 10

11 Department of Computer Science Exercise 1: XML Data How to prevent this? 11

12 Department of Computer Science Exercise 1: XML Data How to prevent this? With a DTD/Schema! 12

13 Department of Computer Science Exercise 2: XML Schema Modelling 13

14 Department of Computer Science Exercise 2: XML Schema Modelling 14 Passport number name address Passenger

15 Department of Computer Science Exercise 2: XML Schema Modelling 15 code name tax Passport number name address Airport Passenger

16 Department of Computer Science Exercise 2: XML Schema Modelling 16 code name tax flightID seatNo date Passport number name address Airport Flight Passenger

17 Department of Computer Science Exercise 2: XML Schema Modelling 17 code name tax flightID seatNo date Passport number name address Airport Flight Passenger source dest

18 Department of Computer Science Exercise 2: XML Schema Modelling 18 code name tax flightID seatNo date credit card Passport number name address Airport Flight Passenger source dest book

19 Department of Computer Science Exercise 2: XML Schema Modelling 19 code name tax flightID seatNo date credit card Passport number name address Airport Flight Passenger source dest book 1 1 N N N M

20 Department of Computer Science Exercise 2: Whats wrong? 20

21 Department of Computer Science Exercise 2: Inconsistency 21

22 Department of Computer Science Exercise 2: Inconsistency 22

23 Department of Computer Science Exercise 2: Redundancy 23

24 Department of Computer Science Exercise 2: Redundancy 24

25 Department of Computer Science Exercise 2: Extraneous data 25

26 Department of Computer Science Exercise 2: A Schema for Passenger 26 Passport number name address Passenger

27 Department of Computer Science Exercise 2: A Schema for Passenger 27 Passport number name address Passenger

28 Department of Computer Science Exercise 2: A Schema for Flight 28 flightID seatNo date Airport Flight source dest

29 Department of Computer Science Exercise 2: A Schema for Flight 29 flightID seatNo date Airport Flight source dest

30 Department of Computer Science Exercise 2: A Schema for Flight 30 flightID seatNo date Airport Flight source dest

31 Department of Computer Science Exercise 2: A Schema for Flight 31 flightID seatNo date Airport Flight source dest

32 Department of Computer Science Exercise 2: A Schema for Airport 32 code name tax Airport

33 Department of Computer Science Exercise 2: A Schema for Airport 33 code name tax Airport

34 Department of Computer Science Exercise 2: A Schema for Airport 34 code name tax Airport

35 Department of Computer Science Exercise 2: Root Element 35

36 Department of Computer Science Exercise 3: DTD and XML Schema 36

37 Department of Computer Science Exercise 3: Corresponding XML Schema 37

38 Department of Computer Science Exercise 4: Corresponding XML Schema 38

39 Department of Computer Science Exercise 3: Corresponding XML Schema 39

40 Department of Computer Science Exercise 3: Corresponding XML Schema 40

41 Department of Computer Science Exercise 3: Corresponding XML Schema 41

42 Department of Computer Science 42 Hope to see you next week!


Download ppt "XML and Databases Exercise Session 3 (courtesy of Ghislain Fourny/ETH)"

Similar presentations


Ads by Google