XML and XPath. Web Services: XML+XPath2 EXtensible Markup Language (XML) a W3C standard to complement HTML A markup language much like HTML origins: structured.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

What is XML? a meta language that allows you to create and format your own document markups a method for putting structured data into a text file; these.
XML: Extensible Markup Language
Spring Part III: Introduction to XPath XML Path Language.
1 Web Data Management Path Expressions. 2 In this lecture Path expressions Regular path expressions Evaluation techniques Resources: Data on the Web Abiteboul,
XML, XML Schema, Xpath and XQuery Slides collated from various sources, many from Dan Suciu at Univ. of Washington.
An Introduction to XML Based on the W3C XML Recommendations.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 311 Database Systems I The Semistructured Data Model.
Database Management Systems, R. Ramakrishnan1 Introduction to Semistructured Data and XML Chapter 27, Part D Based on slides by Dan Suciu University of.
Agenda from now on Done: SQL, views, transactions, conceptual modeling, E/R, relational algebra. Starting: XML To do: the database engine: –Storage –Query.
CSE 636 Data Integration XML Semistructured Data Document Type Definitions.
1 Lecture 10 XML Wednesday, October 18, XML Outline XML (4.6, 4.7) –Syntax –Semistructured data –DTDs.
1 Lecture 10: Database Design XML Wednesday, October 20, 2004.
Managing XML and Semistructured Data Lecture 6: XPath Prof. Dan Suciu Spring 2001.
XML May 1 st, XML for Representing Data John 3634 Sue 6343 Dick 6363 John 3634 Sue 6343 Dick 6363 row name phone “John”3634“Sue”“Dick” persons.
1 Introduction to Database Systems CSE 444 Lecture 11 Xpath/XQuery April 23, 2008.
1 Lecture 11: Xpath/XQuery Friday, October 20, 2006.
XPath Tao Wan March 04, What is XPath? n A language designed to be used by XSL Transformations (XSLT), Xlink, Xpointer and XML Query. n Primary.
XML and Databases 198:541. XML Motivation  Huge amounts of unstructured data on the web: HTML documents  No structure information  Only format instructions.
XML, XML Schema, XPath and XQuery Query Languages CS561 Slides collated from several sources, including D. Suciu at Univ. of Washington.
1 Lecture 08: XML and Semistructured Data. 2 Outline XML (Section 17) –XML syntax, semistructured data –Document Type Definitions (DTDs) XPath.
Managing XML and Semistructured Data Lecture 2: XML Prof. Dan Suciu Spring 2001.
1 Lecture 08: XML and Semistructured Data. 2 Outline XML (Section 17) –XML syntax, semistructured data –Document Type Definitions (DTDs) XPath.
1 Lecture 16: Querying XML Data: XPath, XQuery Friday, February 11, 2005.
Querying XML February 12 th, Querying XML Data XPath = simple navigation through the tree XQuery = the SQL of XML XSLT = recursive traversal –will.
Introduction to XML This material is based heavily on the tutorial by the same name at
XML – Extensible Markup Language Sivakumar Kuttuva & Janusz Zalewski.
XML: Extensible Markup Language FST-UMAC Gong Zhiguo.
XML eXtensible Markup Language by Darrell Payne. Experience Logicon / Sterling Federal C, C++, JavaScript/Jscript, Shell Script, Perl XML Training XML.
CREATED BY ChanoknanChinnanon PanissaraUsanachote
Semistructured data and XML CS 645 April 5, 2006 Some slide content courtesy of Ramakrishnan & Gehrke, Dan Suciu, Zack Ives.
1/17 ITApplications XML Module Session 7: Introduction to XPath.
School of Computing and Management Sciences © Sheffield Hallam University To understand the Oracle XML notes you need to have an understanding of all these.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation An Introduction to XML.
Management of XML and Semistructured Data Lecture 5: Query Languages Wednesday, 4/1/2001.
Lecture 6: XML Query Languages Thursday, January 18, 2001.
Introduction to XML This presentation covers introductory features of XML. What XML is and what it is not? What does it do? Put different related technologies.
XML EXtensible Markup Language. Agenda Introduction to XML XML Rules XML Elements XML Attributes XML Validation XML Exercises XML Namespaces XML CDATA.
CSE 636 Data Integration Fall 2006 XML Query Languages XPath.
WPI, MOHAMED ELTABAKH PROCESSING AND QUERYING XML 1.
What it is and how it works
1 Introduction to Semistructured Data and XML. 2 How the Web is Today  HTML documents often generated by applications consumed by humans only easy access:
More XML: semantics, DTDs, XPATH February 18, 2004.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
XML A Language Presentation. Outline 1. Introduction 2. XML 2.1 Background 2.2 Structure 2.3 Advantages 3. Related Technologies 3.1 DTD 3.2 Schemas and.
IS432 Semi-Structured Data Lecture 4: XPath Dr. Gamal Al-Shorbagy.
Martin Kruliš by Martin Kruliš (v1.1)1.
Lecture 17: XPath and XQuery Wednesday, Nov. 7, 2001.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
1 Lecture 12: XML, XPath, XQuery Friday, October 24, 2003.
 XML derives its strength from a variety of supporting technologies.  Structure and data types: When using XML to exchange data among clients, partners,
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
SEMI-STRUCTURED DATA (XML) 1. SEMI-STRUCTURED DATA ER, Relational, ODL data models are all based on schema Structure of data is rigid and known is advance.
XML – Basic Concepts (modified version from Dr. Praveen Madiraju) 2015, Fall Pusan National University Ki-Joune Li.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
Lecture 14: Relational Algebra Projects XML?
XML path expressions CSE 350 Fall 2003.
Management of XML and Semistructured Data
Management of XML and Semistructured Data
XML in Web Technologies
Semi-Structured data (XML Data MODEL)
What is XML?.
Lecture 9: XML Monday, October 17, 2005.
Allyson Falkner Spokane County ISD
Introduction to Database Systems CSE 444 Lecture 10 XML
Lecture 15: Querying XML Friday, October 27, 2000.
Semi-Structured data (XML)
Lecture 11: XML and Semistructured Data
Presentation transcript:

XML and XPath

Web Services: XML+XPath2 EXtensible Markup Language (XML) a W3C standard to complement HTML A markup language much like HTML origins: structured text SGML motivation: HTML describes presentation XML describes content HTML  XML  SGML (version 2, 10/2000)

Web Services: XML+XPath3 HTML Describes the Presentation

Web Services: XML+XPath4 HTML Describes the Presentation Bibliography Foundations of Databases Abiteboul, Hull, Vianu Addison Wesley, 1995 Data on the Web Abiteoul, Buneman, Suciu Morgan Kaufmann, 1999

Web Services: XML+XPath5 XML Describes the Contents Foundations… Abiteboul Hull Vianu Addison Wesley 1995 …

Web Services: XML+XPath6 More on XML XML was designed to describe data contents XML tags are not predefined in XML. You must “invent” your own tags XML uses a Document Type Definition (DTD) or an XML Schema to describe the data XML with a DTD or XML Schema is designed to be self-descriptive

Web Services: XML+XPath7 Applications and Impact of XML Data can be stored outside HTML Data can be exchanged between incompatible systems Financial information can be exchanged over the Internet Plain text files can be used to share data Data is available to more users Used to create new languages WML, WSDL, BPEL, ……

Web Services: XML+XPath8 Benefits of Using XML XML is structured XML documents are easily committed to a persistence layer XML is platform independent, textual information XML is an open standard XML is language independent DOM and SAX are open, language-independent set of interfaces XML is web enabled XML is totally extensible XML supports shareable structure (using DTDs) XML enables interoperability

Web Services: XML+XPath9 XML Terminology tags: book, title, author, … start tag:, end tag: elements: …, … elements are nested empty element: abbrv. an XML document: single root element well formed XML document: if it has matching tags

Web Services: XML+XPath10 Attributes are Alternative Ways to Represent Data Foundations of Databases Abiteboul … 1995

Web Services: XML+XPath11 CDATA Section Syntax: <![CDATA[ function matchwo (a, b) { if (a < b && a < 0) then { return 1 } else { return 0 } } ]]>

Web Services: XML+XPath12 Entity References Syntax: &entityname; Example: this is less than < Some entities: < < > > & & &apos; ‘ " “ & Unicode char

Web Services: XML+XPath13 Processing Instructions Syntax: Example: Alarm Clock What do they mean ?

Web Services: XML+XPath14 XML Comments Syntax Yes, they are part of the data model !!!

Web Services: XML+XPath15 Name Conflicts Solution: prefix Apples Bananas African Coffee Table Apples Bananas African Coffee Table

Web Services: XML+XPath16 … XML Namespaces syntactic:, semantic: provide URL for schema

Web Services: XML+XPath17 XML Namespaces http: // (1/99) name ::= [prefix:]localpart … 15 …

Web Services: XML+XPath18 (11/99) Building block for other W3C standards: XSL Transformations (XSLT) XML Link (XLink) XML Pointer (XPointer) XML Query Was originally part of XSL XPath

Web Services: XML+XPath19 Example for XPath Queries Addison-Wesley Serge Abiteboul Rick Hull Victor Vianu Foundations of Databases 1995 Freeman Jeffrey D. Ullman Principles of Database and Knowledge Base Systems 1998

Web Services: XML+XPath20 Data Model for XPath bib book publisherauthor.. Addison-WesleySerge Abiteboul The root The root element Processing instruction Comment

Web Services: XML+XPath21 Simple Expressions / bib / book / year Result: / bib / paper / year Result: empty (there were no papers)

Web Services: XML+XPath22 Restricted Kleene Closure // author Result: Serge Abiteboul Rick Hull Victor Vianu Jeffrey D. Ullman / bib // first-name Result: Rick

Web Services: XML+XPath23 Functions /bib/book/author/text() Result: Serge Abiteboul Victor Vianu Jeffrey D. Ullman Rick Hull doesn’t appear because he has firstname, lastname Functions in XPath: text() = matches the text value node() = matches any node (= * or text()) name() = returns the name of the current tag

Web Services: XML+XPath24 Wildcard // author /  Result: Rick Hull  Matches any element

Web Services: XML+XPath25 Attribute Nodes / bib / book Result: means that price is has to be an attribute

Web Services: XML+XPath26 Qualifiers / bib / book / author[first-name] Result: Rick Hull / bib / book / author[firstname][address[ // zip][city]] / lastname Result: … …

Web Services: XML+XPath27 More Qualifiers / bib / < “60”] / bib / book[author < “25”] / bib / book[author / text()]

Web Services: XML+XPath28 XPath Summary bib matches a bib element  matches any element / matches the root element / bib matches a bib element under root bib / paper matches a paper in bib bib // paper matches a paper in bib, at any depth // paper matches a paper at any depth paper|book matches a paper or a a price attribute bib / book matches price attribute in book, in bib bib / / author / lastname matches…

Web Services: XML+XPath29 XPath : More Details An XPath expression, p, establishes a relation between: A context node, and A node in the answer set In other words, p denotes a function: S[ p ] : Nodes -> {Nodes} Examples: author / firstname. = self.. = parent part /  /  / subpart /.. / name = part /  /  [subpart] / name

Web Services: XML+XPath30 The Root 1 2 bib is the document element The root is above bib / bib = returns the document element / = returns the root Why? Because we may have comments before and after ; they become siblings of This is advanced xmlogy

Web Services: XML+XPath31 XPath Navigation We can navigate along 13 axes: ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace parent preceding preceding-sibling self We’ve only seen these, so far

Web Services: XML+XPath32 Examples Examples: child::author / child::lastname = author / lastname child::author / descendant::zip = author // zip child::author / parent::  = author /.. child::author / attribute::age = author What does this mean ? paper / publisher / parent::  / author / bib // address[ancestor::book] / bib // author / ancestor::  // zip

Web Services: XML+XPath33 More Examples name() = the name of the current node / bib //  [name()=book] same as / bib // book What does this mean ? / bib //  [ancestor::  [name()!=book]] Navigation axis gives us strictly more power !