DOC PREVIEW
UW CSE 444 - XML

This preview shows page 1-2-3-22-23-24-44-45-46 out of 46 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Introduction to Database Systems CSE 444 Lecture 28: XML CSE 444 - Autumn 2010Class Evaluation CSE 444 - Autumn 2010 2About the Final • Open book and open notes – But you won’t have time to read during final! – No laptops, no mobile devices • Topics: – Lectures 16 through the end of quarter – Projects 3 and 4 – HW3 • Sample finals on course website! CSE 444 - Autumn 2010 3XML CSE 444 - Autumn 2010 4 Readings New edition: Sections 11.1 – 11.3 and 12.1 Old edition: Subset of material in 4.6 and 4.7 (coverage of XML is better in new version)XML Outline • What is XML? • Syntax • Semistructured data • DTDs • XPath CSE 444 - Autumn 2010 56 What is XML? • Stands for eXtensible Markup Language • Applications: – Data exchange – Un-normalized data • Other usages: – Configuration files: e.g. Web.Config – Document markup: e.g. XHTML • Roots: SGML - a very nasty language We will study only XML as data7 Data Exchange • Relational data does not have a syntax – I can’t “give” you my relational database or parts of it – Need some file format: CSV (comma-separated-values), ASN.1 • XML – Is a more advanced file format – Also has its own data model: semistructured • Main idea: applications exchange information in XML CSE 444 - Autumn 20108 From HTML to XML HTML describes the presentation CSE 444 - Autumn 20109 HTML <h1> Bibliography </h1> <p> <i> Foundations of Databases </i> Abiteboul, Hull, Vianu <br> Addison Wesley, 1995 <p> <i> Data on the Web </i> Abiteboul, Buneman, Suciu <br> Morgan Kaufmann, 1999 HTML describes the presentation CSE 444 - Autumn 201010 XML Syntax <bibliography> <book> <title> Foundations… </title> <author> Abiteboul </author> <author> Hull </author> <author> Vianu </author> <publisher> Addison Wesley </publisher> <year> 1995 </year> </book> … </bibliography> XML describes the content11 XML Terminology • Tags: book, title, author, … • Start tag: <book>, end tag: </book> • Elements: <book>…</book>,<author>…</author> • Elements are nested • Empty element: <red></red> abbrv. <red/> • An XML document: single root element Well formed XML document • Has matching tags • A short header • And a root elementWell-Formed XML CSE 444 - Autumn 2010 12 <? xml version=“1.0” encoding=“utf-8” standalone=“yes” ?> <SomeTag> … </SomeTag>13 More XML: Attributes <book price = “55” currency = “USD”> <title> Foundations of Databases </title> <author> Abiteboul </author> … <year> 1995 </year> </book> CSE 444 - Autumn 201014 Attributes v.s. Elements <book price = “55” currency = “USD”> <title> Foundations of DBs </title> <author> Abiteboul </author> … <year> 1995 </year> </book> Attributes are alternative ways to represent data <book> <title> Foundations of DBs </title> <author> Abiteboul </author> … <year> 1995 </year> <price> 55 </price> <currency> USD </currency> </book> CSE 444 - Autumn 201015 Comparison Elements Attributes Ordered Unordered May be repeated Must be unique May be nested Must be atomic CSE 444 - Autumn 201016 XML v.s. HTML • What are the differences between XML and HTML ? – HTML may be non-well formed: e.g. <br> without </br>. Better: <br/>; XML must be well formed – HTML has semantics: <br> means newline, <i> means italic etc. XML has no semantics CSE 444 - Autumn 201017 XML Semantics: a Tree ! <data> <person id=“o555” > <name> Mary </name> <address> <street>Maple</street> <no> 345 </no> <city> Seattle </city> </address> </person> <person> <name> John </name> <address>Thailand </address> <phone>23456</phone> </person> </data> data Mary person person name address name address street no city Maple 345 Seattle John Thai phone 23456 id o555 Element node Text node Attribute node Order matters !!!18 XML Data • XML is self-describing • Schema elements become part of the data – Relational schema: person(name,phone) – In XML <person>, <name>, <phone> are part of the data, and are repeated many times • Consequence: XML is much more flexible • XML = semistructured data CSE 444 - Autumn 201019 Mapping Relational Data to XML Data <person> <row> <name>John</name> <phone> 3634</phone></row> <row> <name>Sue</name> <phone> 6343</phone></row> <row> <name>Dick</name> <phone> 6363</phone></row> </person> row row row name name name phone phone phone “John” 3634 “Sue” “Dick” 6343 6363 Person XML: person Name Phone John 3634 Sue 6343 Dick 6363 The canonical mapping: CSE 444 - Autumn 201020 Mapping Relational Data to XML Data <people> <person> <name> John </name> <phone> 3634 </phone> <order> <date> 2002 </date> <product> Gizmo </product> </order> <order> <date> 2004 </date> <product> Gadget </product> </order> </person> <person> <name> Sue </name> <phone> 6343 </phone> <order> <date> 2004 </date> <product> Gadget </product> </order> </person> </people> Person Name Phone John 3634 Sue 6343 Application specific mapping Orders PersonName Date Product John 2002 Gizmo John 2004 Gadget Sue 2002 Gadget XML21 XML is Semi-structured Data • Missing attributes: • Could represent in a table with nulls <person> <name> John</name> <phone>1234</phone> </person> <person> <name>Joe</name> </person> no phone ! name phone John 1234 Joe - CSE 444 - Autumn 201022 XML is Semi-structured Data • Repeated attributes • Impossible in tables: <person> <name> Mary</name> <phone>2345</phone> <phone>3456</phone> </person> name phone Mary 2345 3456 ??? Two phones ! CSE 444 - Autumn 201023 XML is Semi-structured Data • Attributes with different types in different objects • Nested collections (no 1NF) • Heterogeneous collections: – <db> contains both <book>s and <publisher>s <person> <name> <first> John </first> <last> Smith </last> </name>


View Full Document

UW CSE 444 - XML

Documents in this Course
XML

XML

48 pages

SQL

SQL

25 pages

SQL

SQL

42 pages

Recovery

Recovery

30 pages

SQL

SQL

36 pages

Indexes

Indexes

35 pages

Security

Security

36 pages

Wrap-up

Wrap-up

6 pages

SQL

SQL

37 pages

More SQL

More SQL

48 pages

SQL

SQL

35 pages

Triggers

Triggers

26 pages

Load more
Download XML
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view XML and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view XML 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?