C-XPath-XQuery

C-XPath-XQuery - XML,XPath,andXQuery ZacharyG.Ives...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
XML, XPath, and XQuery Zachary G. Ives University of Pennsylvania October 22, 2007 e slide content courtesy of Susan Davidson & Raghu Ramakrishnan
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Administrivia Homework 3 is due NOW Reminder: midterm on Wednesday Mengmeng will administer the midterm (I am out of  town on Wed)
Background image of page 2
3 Structural Constraints: Document Type Definitions (DTDs) The DTD is an EBNF grammar defining XML  structure XML document specifies an associated DTD, plus the  root element DTD specifies children of the root (and so on) DTD defines special significance for attributes: IDs – special attributes that are analogous to keys for  elements IDREFs – references to IDs IDREFS – a nasty hack that represents a list of  IDREFs
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 An Example DTD Example DTD: <!ELEMENT dblp((mastersthesis | article)*)> <!ELEMENT mastersthesis(author,title,year,school,committeemember*)> <!ATTLIST mastersthesis(mdate CDATA #REQUIRED key ID #REQUIRED advisor CDATA #IMPLIED> <!ELEMENT author(#PCDATA)> Example use of DTD in XML file: <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE dblp SYSTEM “my.dtd">   <dblp>…
Background image of page 4
5 Representing Graphs and Links in XML <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE graph SYSTEM “special.dtd"> < graph > < author id =“author1”> < name >John Smith</ name > </ author > < article > < author ref =“author1” /> < title >Paper1</ title > </ article > < article > < author ref =“author1” /> < title >Paper2</ title > </ article >
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Graph Data Model Root !DOCTYPE graph author article name title ref ref John Smith author1 author1 Paper2 ?xml article id author1 author author title Paper1
Background image of page 6
7 Graph Data Model Root !DOCTYPE graph author article name title ref ref John Smith Paper2 ?xml article id author1 author author title Paper1
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 DTDs Aren’t Expressive Enough DTDs capture grammatical structure, but have  some drawbacks: Not themselves in XML – inconvenient to build tools  for them Don’t capture database datatypes’ domains IDs aren’t a good implementation of keys Why not? No way of defining OO-like inheritance
Background image of page 8
9 XML Schema Aims to address the shortcomings of DTDs XML syntax Can define keys using XPaths Type subclassing that’s more complex than in a  programming language Programming languages don’t consider order of member  variables! Subclassing “by extension” and “by restriction” … And, of course, domains and built-in datatypes
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Basics of XML Schema Need to use the XML Schema namespace (generally  named xsd) simpleTypes  are a way of restricting domains on scalars Can define a  simpleType  based on integer, with values within a  particular range complexTypes  are a way of defining element/attribute 
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 10/31/2010.

Page1 / 35

C-XPath-XQuery - XML,XPath,andXQuery ZacharyG.Ives...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online