Data Model: World Cup 2018 by Viji Kumar - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub for a complete version.

Chapter 6 - XML

This chapter will provide the XML schema necessary to ensure that the apex game data in XML documents conform to the tournament model constructed in Chapter 4. The schemas for complete tournaments, leagues and head to heads can also be constructed using similar components to those discussed below and based on the specifications in Chapter 5. A namespace is required to qualify the elements defined to represent the entities in this model. The namespace used is rts (Report Team Sport). For information about the use of XML, go to the World Wide Web Consortium’s site at www.w3.org/standards/xml/, as there are appropriate tools and languages for providing the data as web resources.

Image

The XML document below provides information about the two apex games of the 2018 World Cup tournament. The document can have any number of the 7 entity types shown above as required. To report on all the games of the 2017/18 Premier League season, an XML document would need to contain 20 teams and venues, 380 league games and over 1000 league goals. The outline of the XML document shows elements which are equivalent to the records from the database tables and have the same names as the tables. Although the schema allows for it, the document does not have any penalty shoot-out information.

Image

Image

Image

Image

Image

Image

The XML document can be validated against a schema. The complete schema for the apex game model is provided in the Appendix. There are three types of components in this schema; simple types, complex types and a root element. The simple types are used to construct other simple types and the complex types. The complex types are used to construct other complex types and the root element. The root element defines the elements in the XML document shown above. The definition of the root element includes the primary keys (xs:key), the secondary keys (xs:unique) and foreign keys (xs:keyref), in addition to the above 7 entity types or elements.

Image

Three data types for use in XML schemas; xs:integer, xs:dateTime and xs:string are the simple types used here. The last is extended to specify the additional specialised data types discussed in Chapter 5. Also shown below are the complex types used to assemble the apex game entity type. Note that the venue, scheduled start, team one and team two may not be known during the earlier stages of a competition and can be absent.

Image

Image

The root element is made up of seven elements that are listed together with their primary, secondary and foreign keys. The seven elements are the entity types describing an apex game. Some examples of the different types of keys are also shown below.

Image

Image

Image

Image