1 © The ATHENA Consortium. XML, eXtensible Markup Language (1) The format for structured information exchange. –Primary structuring is containment and sequence. –A valid XML document is a tree Alice Smith 123 Maple Street … Robert Smith … Hurry, my lawn is going wild! Lawnmower Confirm this is electric …
2 © The ATHENA Consortium. XML tree structure Root shipTo items comment street state city zip billTo street state city zip Mill Valley 123 Maple Street CA Alice Smith US 90952Old Town 8 Oak Avenue PA Robert Smith US Hurry, my lawn is going wild! item quantity USPrice Lawnmower 872 -AA comment Confirm this is electric shipDate … item …
3 © The ATHENA Consortium. XML document
4 © The ATHENA Consortium. XML, eXtensible Markup Language (2) Alice Smith 123 Maple Street … Robert Smith … Hurry, my lawn is going wild! Lawnmower Confirm this is electric … The format for structured information exchange. –Primary structuring is containment and sequence. –A valid XML document is a tree Extensible – anyone can “coin” markup tags Is an application of SGML, the Structured Markup Language –a standard for marking- up documents Can be edited with any text editor
5 © The ATHENA Consortium. XML Schema …. Defines a class of documents –Allowed structure, content and constraints –An XML document can be an instance of the schema class Uses XML syntax –Can use XML tools to process it Has a large set of pre- defined simple data-types that can be extended. Instances can be validated against the schema
6 © The ATHENA Consortium. XML in document exchange Standard Lawnmower 872-AA Lawnmower 872-AA... LineItem database table: databasedatabase XML
7 © The ATHENA Consortium. Database and database schema movieNamereleaseYeardirector Annie Hall1977Woody Allen Dr. Strangelove1964Stanley Kubrick movieNameactor Annie HallWoody Allen Annie HallDiane Keaton Dr. StrangelovePeter Sellers Movie: Starred: Movie (movieName, releaseYear, director) Starred (movieName, actor) Example based on p. 5 of “Information Modeling and Relational Databases” by Terry Halpin, 2001
8 © The ATHENA Consortium. Questions What is one of the primary purposes of XML? 2.What is one of the primary purposes of XML Schema? 3.What do databases and XML have in common? That completes the topic of XML, now for some questions:
9 © The ATHENA Consortium. Answers What is one of the primary purposes of XML? –To exchange structured data 2.What is one of the primary purposes of XML Schema? –To define a class of documents –To validate an XML document as an instance of the class 3.What do databases and XML have in common? –Structured information –Schemas –Constraints