1 / 42

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

XML and Databases Exercise Session 3 (courtesy of Ghislain Fourny/ETH). 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.

Télécharger la présentation

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

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML and DatabasesExercise Session 3(courtesy of Ghislain Fourny/ETH)

  2. 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

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

  4. Good to know: XML Schema types • They can also be anonymous. 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. Complex types in XML Schema • Complex type, complex content

  6. Complex types in XML Schema • Simple content (here anonymous)

  7. 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

  8. Exercises 1-3 • Passenger • Flight • Airport • Booking

  9. 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

  10. Exercise 1: XML Data • Sample data

  11. Exercise 1: XML Data • How to prevent this?

  12. Exercise 1: XML Data • How to prevent this? • With a DTD/Schema!

  13. Exercise 2: XML Schema Modelling

  14. Exercise 2: XML Schema Modelling Passenger Passport number address name

  15. Exercise 2: XML Schema Modelling code name tax Airport Passenger Passport number address name

  16. Exercise 2: XML Schema Modelling code seatNo flightID name date tax Flight Airport Passenger Passport number address name

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

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

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

  20. Exercise 2: What‘s wrong?

  21. Exercise 2: Inconsistency

  22. Exercise 2: Inconsistency

  23. Exercise 2: Redundancy

  24. Exercise 2: Redundancy

  25. Exercise 2: Extraneous data

  26. Exercise 2: A Schema for Passenger Passenger Passport number address name

  27. Exercise 2: A Schema for Passenger Passenger Passport number address name

  28. Exercise 2: A Schema for Flight seatNo flightID date source Flight Airport dest

  29. Exercise 2: A Schema for Flight seatNo flightID date source Flight Airport dest

  30. Exercise 2: A Schema for Flight seatNo flightID date source Flight Airport dest

  31. Exercise 2: A Schema for Flight seatNo flightID date source Flight Airport dest

  32. Exercise 2: A Schema for Airport code name tax Airport

  33. Exercise 2: A Schema for Airport code name tax Airport

  34. Exercise 2: A Schema for Airport code name tax Airport

  35. Exercise 2: Root Element

  36. Exercise 3: DTD and XML Schema

  37. Exercise 3: Corresponding XML Schema

  38. Exercise 4: Corresponding XML Schema

  39. Exercise 3: Corresponding XML Schema

  40. Exercise 3: Corresponding XML Schema

  41. Exercise 3: Corresponding XML Schema

  42. Hope to see you next week!

More Related