Notes on XML and XQuery in Relational Databases

Size: px
Start display at page:

Download "Notes on XML and XQuery in Relational Databases"

Transcription

1 xquery.txt Tue Apr 04 11:29: Notes on XML and XQuery in Relational Databases Owen Kaser March 22, Updated April 4, 2017 some code frags are untested! As usual, the idea is to give you a taste of some things, without exploring all details, but letting you do some simple things. There are likely a fair number of errors in this, though I have tested many code fragments. Corrections appreciated.

2 xquery.txt Tue Apr 04 11:29: Prerequisites Your textbook gives a quick introduction to XML and XQuery. Plus it mentions that XML can be stored and manipulated in relational databases. Make sure you understand what it says. We ll look at this with a few more details.

3 xquery.txt Tue Apr 04 11:29: Mini Review XML documents and fragments contain nested elements (delimited by tags). Elements can have attributes. <classroster> <student snum="12345"> <sname> Owen Kaser </sname> <gpa> 1.1 </gpa> <friends> <friend> <student snum="6789"/> </friend> <friend> <student snum="1111"> <gpa> 2.2 </gpa> </student></friend> </friends></student> <student snum="33333"> <sname> Newo Resak </sname> <age> 25 </age></student> </classroster>

4 xquery.txt Tue Apr 04 11:29: XML Review In previous example, we have elements: classroster, student, sname, gpa, friends, friend. tags: eg <classroster>, </classroster> and <student/> attributes: snum text: eg Newo Resak. There is a "family tree" type relationship between elements: the classroster element is the parent of two student elements. We speak of parents, children, siblings, ancestors, descendants, etc. Topmost element is called the "root". We are not told whether there is an applicable schema: we don t know whether snum must always be an integer, whether the text for age could be "really old" instead of "25", etc.

5 xquery.txt Tue Apr 04 11:29: XPath [ The W3C defines an XPath language that you can use to locate elements within a bunch of XML. It is important in other XML technologies, including XQuery. XPath lets you write expressions that return a "node" or a set of nodes. "Nodes" include elements, attributes, text and 4 other kinds. Example paths in example XML doc /classroster/student[1]//gpa start at root, which must a classroster node of its student element children, take first. any gpa elements that are descendants are returned. In this case, just two: <gpa> 2.2 </gpa> and <gpa> 1.1 </gpa>

6 xquery.txt Tue Apr 04 11:29: More XPath examples //gpa this gives the set of all gpa elements anywhere. (In this example, there are two) //@snum gives the set of all snum attributes anywhere //student//friend//@snum only those snum attributes somewhere inside a friend element, somewhere inside a student element

7 xquery.txt Tue Apr 04 11:29: Wildcards * matches any element node *@ matches any attribute node node() matches any node text() matches any text node ** possible broken note: example queries seem to put node() and text() in [] for some reason eg //friends//@* will return same thing as //friends//@snum in our example, because we don t have any other attributes

8 xquery.txt Tue Apr 04 11:29: Axes //, / seem to be shorthands axis names: child (seems like default, with /) attribute (seems prefix) descendant (seems like //) ancestor preceding (everything before here) following Eg: descendant::friends/descendant::*/attribute::snum same as //friends//@snum If current node is the first student, then following::* is be the second student (all that is left)

9 xquery.txt Tue Apr 04 11:29: Predicates Sometimes, you want to provide tests. Use [] eg. /classroster/student[@snum>10]/gpa (Both relevant snums (12345 and 33333) pass the test) //student[gpa > 1.0]

10 xquery.txt Tue Apr 04 11:29: Merging node sets The operator can form a union eg //gpa //friends

11 xquery.txt Tue Apr 04 11:29: XPath functions( There are MANY useful functions, including doc(url) - read an XML node from a file or URL eg doc("myfile.xml") count(item list), avg(number list) - count, average also max, min, sum filter, fold-left, fold-right, for-each: for "functional programming", beyond our scope has-children() - boolean head(list of items) - gives first item tail(list of items) - all but head insert-before(list of items) number() - item as a double subsequence(list, startpos, length) string-length, upper-case op:to(low,high) or use the "to" operator 1 to 5 generates sequence 1,2,3,4,5 op:is-same-node or use the "is" operator zillions of date/time functions

12 xquery.txt Tue Apr 04 11:29: XQuery XQuery is supposed to be "the SQL of XML". Another W3C technology. Uses XPath heavily. All XPath functions listed earlier can be used. A single XPath expression can be an XQuery FLWOR expressions: For-Let-Where-OrderBy-Return optional sections, in that order (well, Return is mandatory, and either For or Let) Variables with $ prefix. case sensitive Strings with or " (: This is a comment :)

13 xquery.txt Tue Apr 04 11:29: Comparisons: = vs eq : Suppose XPR is an XPath expression XPR eq 5 requires that the XPath set have exactly one value in it. Is it equal to 5? XPR = 5 can handle XPath sets with several values; if any of them are 5, you re good Also, eq would require xsd:integer for XPR but without a schema to say otherwise, XPR might have incompatible type untypedatomic. But = can handle this. Similary for > and gt, <= and le, etc.

14 xquery.txt Tue Apr 04 11:29: XQuery: for for VAR in EXPRESSION where EXPRESSION is an XPath expression or a function giving a sequence eg: for $foo in doc("myfile.xml")//friend eg: for $foo in (3 to 10)

15 xquery.txt Tue Apr 04 11:29: XQuery: nested for for $foo in (1 to 5), $bar in (2 to 6) essentially, the $bar loop is nested.

16 xquery.txt Tue Apr 04 11:29: XQuery: let Let allows an assignment, goes with := operator let $midpoint := ($start + $finish) div 2

17 xquery.txt Tue Apr 04 11:29: XQuery: where The where clause provides additional filtering, beyond what you may have done with predicates in the XPath statement. If you have "nested fors", this can be extra useful. for $x in (1 to 5), $y in (1 to 5) let $mid = ($x + $y) div 2 where $x gt $y return <owen> { $mid } </owen>

18 xquery.txt Tue Apr 04 11:29: XQuery: order by Order by does what you expect... order by $x/gpa

19 xquery.txt Tue Apr 04 11:29: XQuery: return Each ordered result then produces an XML fragment. You can use an XPath expression eg return $x/gpa Or you can generate some XML elements with varying stuff based on your variables. Note the use of {} eg return <foo><bar>{$x}</bar></foo> There is an if-then-else expression, plus all those lovely XPath functions

20 xquery.txt Tue Apr 04 11:29: Defining your own functions You can even define your own functions, though that s getting too fancy for us. For instance declare function foo ( $param1 as node()?, $param2 as xs:anyatomictype) as xs:anyatomictype* { if ($param1) then fn:data($param1) else $param2 }

21 xquery.txt Tue Apr 04 11:29: XQuery and XML in Oracle 12c see docs.oracle.com/database/121/adxdb/xdb_xquery.htm The SQL standard has a part called SQL/XML that standardizes the use of XML in SQL databases. Oracle SQL uses a data type XMLTYPE whereas SQL/XML says it should have been called XML. You can have columns of xmltype in your tables. Optionally, tell Oracle how to store the XML columns and do things to help indexing the XML. eg create table t( x xmltype);

22 xquery.txt Tue Apr 04 11:29: Getting some XML into a table There are a variety of ways to get XML. One is to use xmltype as a constructor, to convert a string into XML. insert into t values (xmltype( <classroster> <student snum="12345"> <sname> Owen Kaser </sname> <gpa> 1.1 </gpa> <friends>...stuff omitted... </classroster> )); Table t now has one row.

23 xquery.txt Tue Apr 04 11:29: Getting XML out of a table Can supposedly process the whole table as hunk of XML. In a table with an XMLType column and nothing else, Oracle docs suggest you can retrieve the "pseudocolumn" OBJECT_VALUE eg select object_value from t; Note that it didn t work for me.

24 xquery.txt Tue Apr 04 11:29: Getting XML fragments out You can process individual fragments of XML from a table using "XMLQuery". It takes an XQuery and passes in a value (t.x below) for processing select xmlquery( for $i in //student where $i/gpa > 1.5 order by $i/gpa return $i/@snum passing x returning content) from t; This returns The "passing" and "returning content" keywords are mandatory with xmlquery.

25 xquery.txt Tue Apr 04 11:29: "Passing as" You can associate a table attribute to a variable using "passing as". Below, variable $d is set to the chunk of XML in attribute x. select xmlquery( for $i in $d//student where $i/gpa > 1.5 order by $i/gpa return $i/@snum passing x as "d" returning content) from t; This returns 1111, as before.

26 xquery.txt Tue Apr 04 11:29: XMLExists and XMLcast XMLExists is useful for Boolean tests. It returns true if an XQuery expression has any results. XMLCast can turn xml into a string, discarding tags select xmlcast(x as varchar(1000)) from t where xmlexists( $y//gpa passing x as "y"); This returns a varchar version of the text portions of our data, since there was at least one gpa element. Owen Kaser Newo Resak 25

27 xquery.txt Tue Apr 04 11:29: XMLTable XMLTable converts the result of an XQuery into a relational table. Suppose that our usual table t had its usual XML column x, but also had a VARCHAR column y select y, xx.stunum, xx.gpacol from t, xmltable( /classroster//student passing t.x columns stunum int gpacol number path gpa ) xx where xx.gpacol > 1.2; For each row of t, t.x will be turned into a little table with a row for each student element in t.x, along with the student s id number and gpa (which might be null)

28 xquery.txt Tue Apr 04 11:29: Manufacturing XML yourself use XMLElement and XMLAttributes as follows select xmlelement("foo", xmlelement("contact", xmlattributes(e.employeeid as "bar"))) from employee_t e; to produce (one toplevel element per employee) <foo><contact bar=" "></contact></foo> <foo><contact bar=" "></contact></foo> <foo><contact bar=" "></contact></foo> <foo><contact bar=" "></contact></foo> <foo><contact bar="laura"></contact></foo>

29 xquery.txt Tue Apr 04 11:29: XMLAgg If you want to put the various rows into a single XML item, use XMLAgg as follows: select xmlelement("foo", (xmlagg( xmlelement("contact", xmlattributes(e.employeeid as "bar"))))) from employee_t e; which gives <foo> <contact bar=" "> </contact> <contact bar=" "></contact> <contact bar=" "></contact> <contact bar=" "></contact> <contact bar="laura"></contact> </foo>

30 xquery.txt Tue Apr 04 11:29: Summary Conventional relational databases like Oracle can handle semi-structured XML documents. XPath and XQuery give many opportunities to work with the XML information (But native XML databases might be more efficient if all you want to do is process lots of XML.)

31 xquery.txt Tue Apr 04 11:29: XML s alternative: JSON XML is rather verbose. It has a lot of technology built around it (eg, XQuery) and libraries for XML processing are available for all major languages. It has been widely used for information exchange. But its verbosity hurts. JSON (Javascript Object Notation) now challenges XML for information interchange. It s simpler. JSON s essentially a dump of a Javascript data structure. So if the JSON is received by Javascript code (eg running in a browser for a web application), it is more easily dealt with than XML.

32 xquery.txt Tue Apr 04 11:29: JSON example (our running example in JSON) Thanks to "classroster": { "student": [ { "-snum": "12345", "sname": " Owen Kaser ", "gpa": " 1.1 ", "friends": { "friend": [ { "student": { "-snum": "6789" }}, { "student": { "-snum": "1111", "gpa": " 2.2 " }}]}}, { "-snum": "33333", "sname": " Newo Resak ", "age": " 25 " }]}}

33 xquery.txt Tue Apr 04 11:29: Ease of Use Javascript code easily reads JSON into an in-memory object and processes it there, natively. Something similar using XML requires more complex processing: a "DOM parser" builds a data structure that requires tedious API calls to process. Though XML is a pain to process this way, it has nifty standardized tools like XQuery that enable higher-level processing. The JSON world wasn t as rich. But XQuery 3.1 (we use earlier versions) has support for converting JSON to/from XML. REST web services tend to prefer JSON over XML. SOAP web services require XML. SOAP can do some things that REST can t. But most people don t need to do these complicated things.

34 xquery.txt Tue Apr 04 11:29: SOAP/XML vs REST/JSON example From keithba.net/simplicity-and-utility-or-why-soap-lost POST /customers HTTP/1.1 Host: Content-Type: application/soap+xml; charset=utf-8 <?xml version="1.0"?> <soap:envelope xmlns:soap=" <soap:body> <m:getcustomer xmlns:m=" <m:customerid>43456</m:customerid> </m:getcustomer> </soap:body> </soap:envelope> for SOAP, vs for REST GET /customers/43456 HTTP/1.1 Host:

35 xquery.txt Tue Apr 04 11:29: SOAP/XML vs REST/JSON example, Data returned, first for SOAP HTTP/ OK Content-Type: application/soap+xml; charset=utf-8 <?xml version= 1.0?> <env:envelope xmlns:env=" > <env:body> <m:getcustomerresponse xmlns:m=" <m:customer>foobar Quux, inc</m:customer> </m:getcustomerresponse> </env:body> </env:envelope> then for REST HTTP/ OK Content-Type: application/json; charset=utf-8 { Customer : Foobar Quux, inc }

Oracle XML DB and Native Web Services

Oracle XML DB and Native Web Services Oracle XML DB and Native Web Services Ondřej Kupka December 3, 2012 Section Layout 1 Oracle XML DB Overview Core Ideas and Architecture Storing XML Data Example Structured Model and XML Schemas XML/SQL

More information

XML databases. Jan Chomicki. University at Buffalo. Jan Chomicki (University at Buffalo) XML databases 1 / 9

XML databases. Jan Chomicki. University at Buffalo. Jan Chomicki (University at Buffalo) XML databases 1 / 9 XML databases Jan Chomicki University at Buffalo Jan Chomicki (University at Buffalo) XML databases 1 / 9 Outline 1 XML data model 2 XPath 3 XQuery Jan Chomicki (University at Buffalo) XML databases 2

More information

Author: Irena Holubová Lecturer: Martin Svoboda

Author: Irena Holubová Lecturer: Martin Svoboda A7B36XML, AD7B36XML XML Technologies Lecture 4 XPath, SQL/XML 24. 3. 2017 Author: Irena Holubová Lecturer: Martin Svoboda http://www.ksi.mff.cuni.cz/~svoboda/courses/2016-2-a7b36xml/ Lecture Outline XPath

More information

Part VII. Querying XML The XQuery Data Model. Marc H. Scholl (DBIS, Uni KN) XML and Databases Winter 2005/06 153

Part VII. Querying XML The XQuery Data Model. Marc H. Scholl (DBIS, Uni KN) XML and Databases Winter 2005/06 153 Part VII Querying XML The XQuery Data Model Marc H. Scholl (DBIS, Uni KN) XML and Databases Winter 2005/06 153 Outline of this part 1 Querying XML Documents Overview 2 The XQuery Data Model The XQuery

More information

Session: E14 Unleash SQL Power to your XML Data. Matthias Nicola IBM Silicon Valley Lab

Session: E14 Unleash SQL Power to your XML Data. Matthias Nicola IBM Silicon Valley Lab Session: E14 Unleash SQL Power to your XML Data Matthias Nicola IBM Silicon Valley Lab 16 October 2008 09:00 10:00am Platform: DB2 for z/os and DB2 for Linux, Unix, Windows SQL is no longer the purely

More information

XML Data Management. 5. Extracting Data from XML: XPath

XML Data Management. 5. Extracting Data from XML: XPath XML Data Management 5. Extracting Data from XML: XPath Werner Nutt based on slides by Sara Cohen, Jerusalem 1 Extracting Data from XML Data stored in an XML document must be extracted to use it with various

More information

One of the main selling points of a database engine is the ability to make declarative queries---like SQL---that specify what should be done while

One of the main selling points of a database engine is the ability to make declarative queries---like SQL---that specify what should be done while 1 One of the main selling points of a database engine is the ability to make declarative queries---like SQL---that specify what should be done while leaving the engine to choose the best way of fulfilling

More information

Informatics 1: Data & Analysis

Informatics 1: Data & Analysis T O Y H Informatics 1: Data & Analysis Lecture 11: Navigating XML using XPath Ian Stark School of Informatics The University of Edinburgh Tuesday 26 February 2013 Semester 2 Week 6 E H U N I V E R S I

More information

Semi-structured Data. 8 - XPath

Semi-structured Data. 8 - XPath Semi-structured Data 8 - XPath Andreas Pieris and Wolfgang Fischl, Summer Term 2016 Outline XPath Terminology XPath at First Glance Location Paths (Axis, Node Test, Predicate) Abbreviated Syntax What is

More information

XML: Extensible Markup Language

XML: Extensible Markup Language XML: Extensible Markup Language CSC 375, Fall 2015 XML is a classic political compromise: it balances the needs of man and machine by being equally unreadable to both. Matthew Might Slides slightly modified

More information

H2 Spring B. We can abstract out the interactions and policy points from DoDAF operational views

H2 Spring B. We can abstract out the interactions and policy points from DoDAF operational views 1. (4 points) Of the following statements, identify all that hold about architecture. A. DoDAF specifies a number of views to capture different aspects of a system being modeled Solution: A is true: B.

More information

Query Languages for XML

Query Languages for XML Query Languages for XML XPath XQuery 1 The XPath/XQuery Data Model Corresponding to the fundamental relation of the relational model is: sequence of items. An item is either: 1. A primitive value, e.g.,

More information

Table of Contents Chapter 1 - Introduction Chapter 2 - Designing XML Data and Applications Chapter 3 - Designing and Managing XML Storage Objects

Table of Contents Chapter 1 - Introduction Chapter 2 - Designing XML Data and Applications Chapter 3 - Designing and Managing XML Storage Objects Table of Contents Chapter 1 - Introduction 1.1 Anatomy of an XML Document 1.2 Differences Between XML and Relational Data 1.3 Overview of DB2 purexml 1.4 Benefits of DB2 purexml over Alternative Storage

More information

Chapter 13 XML: Extensible Markup Language

Chapter 13 XML: Extensible Markup Language Chapter 13 XML: Extensible Markup Language - Internet applications provide Web interfaces to databases (data sources) - Three-tier architecture Client V Application Programs Webserver V Database Server

More information

XML. Semi-structured data (SSD) SSD Graphs. SSD Examples. Schemas for SSD. More flexible data model than the relational model.

XML. Semi-structured data (SSD) SSD Graphs. SSD Examples. Schemas for SSD. More flexible data model than the relational model. Semi-structured data (SSD) XML Semistructured data XML, DTD, (XMLSchema) XPath, XQuery More flexible data model than the relational model. Think of an object structure, but with the type of each object

More information

Inside Oracle Database 11g Release 2 XML DB. Nipun Agarwal Vikas Arora Mark Drake Director Senior Manager Product Manager

Inside Oracle Database 11g Release 2 XML DB. Nipun Agarwal Vikas Arora Mark Drake Director Senior Manager Product Manager Inside Oracle Database 11g Release 2 XML DB Nipun Agarwal Vikas Arora Mark Drake Director Senior Manager Product Manager The following is intended to outline our general product direction. It is intended

More information

TDDD43. Theme 1.2: XML query languages. Fang Wei- Kleiner h?p:// TDDD43

TDDD43. Theme 1.2: XML query languages. Fang Wei- Kleiner h?p://  TDDD43 Theme 1.2: XML query languages Fang Wei- Kleiner h?p://www.ida.liu.se/~ Query languages for XML Xpath o Path expressions with conditions o Building block of other standards (XQuery, XSLT, XLink, XPointer,

More information

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 27-1

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 27-1 Slide 27-1 Chapter 27 XML: Extensible Markup Language Chapter Outline Introduction Structured, Semi structured, and Unstructured Data. XML Hierarchical (Tree) Data Model. XML Documents, DTD, and XML Schema.

More information

Lesson 15 Transcript: Pure XML SQL / XML & XQuery

Lesson 15 Transcript: Pure XML SQL / XML & XQuery Lesson 15 Transcript: Pure XML SQL / XML & XQuery Slide 1: Cover Welcome to Lesson 15 of DB2 on Campus lecture series. Today, we are going to talk about Pure XML-SQL and the use of XML and XQuery. My name

More information

Big Data 12. Querying

Big Data 12. Querying Ghislain Fourny Big Data 12. Querying pinkyone / 123RF Stock Photo Declarative Languages What vs. How 2 Functional Languages for let order by if + any else = then every while where return exit with Expression

More information

The XQuery Data Model

The XQuery Data Model The XQuery Data Model 9. XQuery Data Model XQuery Type System Like for any other database query language, before we talk about the operators of the language, we have to specify exactly what it is that

More information

Big Data 10. Querying

Big Data 10. Querying Ghislain Fourny Big Data 10. Querying pinkyone / 123RF Stock Photo 1 Declarative Languages What vs. How 2 Functional Languages for let order by if + any else = then every while where return exit with Expression

More information

Creating and Working with JSON in Oracle Database

Creating and Working with JSON in Oracle Database Creating and Working with JSON in Oracle Database Dan McGhan Oracle Developer Advocate JavaScript & HTML5 January, 2016 Safe Harbor Statement The following is intended to outline our general product direction.

More information

7 JSON and XML: Giving Messages a Structure

7 JSON and XML: Giving Messages a Structure JSON and XML: Giving Messages a Structure 7 JSON and XML: Giving Messages a Structure (some) Limitations of Relational Databases Documents: how to store a book or a system manual using a relational table?

More information

Part XII. Mapping XML to Databases. Torsten Grust (WSI) Database-Supported XML Processors Winter 2008/09 321

Part XII. Mapping XML to Databases. Torsten Grust (WSI) Database-Supported XML Processors Winter 2008/09 321 Part XII Mapping XML to Databases Torsten Grust (WSI) Database-Supported XML Processors Winter 2008/09 321 Outline of this part 1 Mapping XML to Databases Introduction 2 Relational Tree Encoding Dead Ends

More information

DBS2: Exkursus XQuery and XML-Databases. Jan Sievers Jens Hündling Lars Trieloff

DBS2: Exkursus XQuery and XML-Databases. Jan Sievers Jens Hündling Lars Trieloff DBS2: Exkursus XQuery and XML-Databases Jan Sievers Jens Hündling Lars Trieloff Motivation XML ubiquitous data exchange format Can be used to present Object data, relational data, semi-structured data

More information

XPath. Asst. Prof. Dr. Kanda Runapongsa Saikaew Dept. of Computer Engineering Khon Kaen University

XPath. Asst. Prof. Dr. Kanda Runapongsa Saikaew Dept. of Computer Engineering Khon Kaen University XPath Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Dept. of Computer Engineering Khon Kaen University 1 Overview What is XPath? Queries The XPath Data Model Location Paths Expressions

More information

Introduction to XQuery and XML Databases

Introduction to XQuery and XML Databases Introduction to XQuery and XML Databases TEI@Oxford July 2009 XQuery While XSLT is good for transforming XML to other formats (XML, HTML, PDF, Text, etc.) sometimes you may wish to query a large database

More information

Oracle Database 11g: Use XML DB

Oracle Database 11g: Use XML DB Oracle Database 11g: Use XML DB Volume I Student Guide D52498GC10 Edition 1.0 July 2008 D55322 Authors Chaitanya Koratamaddi Salome Clement Technical Contributors and Reviewers Drew Adams Coby Adams Rohan

More information

XPath node predicates. Martin Holmes

XPath node predicates. Martin Holmes Martin Holmes XPath Node Predicates You use paths and axes in XPath to arrive at specific nodes in your XML. You use predicates to further filter or test those nodes. Only nodes which satisfy the predicate

More information

Navigating Input Documents Using Paths4

Navigating Input Documents Using Paths4 Chapter 4 CHAPTER 4 Navigating Input Documents Using Paths4 Path expressions are used to navigate input documents to select elements and attributes of interest. This chapter explains how to use path expressions

More information

Java EE 7: Back-end Server Application Development 4-2

Java EE 7: Back-end Server Application Development 4-2 Java EE 7: Back-end Server Application Development 4-2 XML describes data objects called XML documents that: Are composed of markup language for structuring the document data Support custom tags for data

More information

XML Technologies. Doc. RNDr. Irena Holubova, Ph.D. Web pages:

XML Technologies. Doc. RNDr. Irena Holubova, Ph.D. Web pages: XML Technologies Doc. RNDr. Irena Holubova, Ph.D. holubova@ksi.mff.cuni.cz Web pages: http://www.ksi.mff.cuni.cz/~holubova/nprg036/ Outline Introduction to XML format, overview of XML technologies DTD

More information

XPath. Lecture 36. Robb T. Koether. Wed, Apr 16, Hampden-Sydney College. Robb T. Koether (Hampden-Sydney College) XPath Wed, Apr 16, / 28

XPath. Lecture 36. Robb T. Koether. Wed, Apr 16, Hampden-Sydney College. Robb T. Koether (Hampden-Sydney College) XPath Wed, Apr 16, / 28 XPath Lecture 36 Robb T. Koether Hampden-Sydney College Wed, Apr 16, 2014 Robb T. Koether (Hampden-Sydney College) XPath Wed, Apr 16, 2014 1 / 28 1 XPath 2 Executing XPath Expressions 3 XPath Expressions

More information

XPath. by Klaus Lüthje Lauri Pitkänen

XPath. by Klaus Lüthje Lauri Pitkänen XPath by Klaus Lüthje Lauri Pitkänen Agenda Introduction History Syntax Additional example and demo Applications Xpath 2.0 Future Introduction Expression language for Addressing portions of an XML document

More information

Navigation. 3.1 Introduction. 3.2 Paths

Navigation. 3.1 Introduction. 3.2 Paths 03Brundage_ch03.qxd 1/8/04 1:09 PM Page 63 C H A P T E R 3 Navigation 3.1 Introduction Once you ve constructed or loaded XML in a query, you need a way to navigate over that hierarchical data. In many

More information

Oracle Database 12c: Use XML DB

Oracle Database 12c: Use XML DB Oracle University Contact Us: 55-800-891-6502 Oracle Database 12c: Use XML DB Duration: 5 Days What you will learn This Oracle Database 12c: Use XML DB training allows you to deep dive into the key features

More information

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014 Lesson 10A OOP Fundamentals By John B. Owen All rights reserved 2011, revised 2014 Table of Contents Objectives Definition Pointers vs containers Object vs primitives Constructors Methods Object class

More information

XPath Lecture 34. Robb T. Koether. Hampden-Sydney College. Wed, Apr 11, 2012

XPath Lecture 34. Robb T. Koether. Hampden-Sydney College. Wed, Apr 11, 2012 XPath Lecture 34 Robb T. Koether Hampden-Sydney College Wed, Apr 11, 2012 Robb T. Koether (Hampden-Sydney College) XPathLecture 34 Wed, Apr 11, 2012 1 / 20 1 XPath Functions 2 Predicates 3 Axes Robb T.

More information

Hierarchical Empire. SEGUS, Inc 06 November :00 a.m. 10:00 a.m. Platform: DB2 for z/os

Hierarchical Empire. SEGUS, Inc 06 November :00 a.m. 10:00 a.m. Platform: DB2 for z/os Episode 9 The Return of the Hierarchical Empire Ulf Heinrich SEGUS, Inc u.heinrich@segus.com 06 November 2007 09:00 a.m. 10:00 a.m. Platform: DB2 for z/os 1 Agenda Af few basics about txmli in general

More information

CSI 3140 WWW Structures, Techniques and Standards. Representing Web Data: XML

CSI 3140 WWW Structures, Techniques and Standards. Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards Representing Web Data: XML XML Example XML document: An XML document is one that follows certain syntax rules (most of which we followed for XHTML) Guy-Vincent

More information

COPYRIGHTED MATERIAL. Contents. Part I: Introduction 1. Chapter 1: What Is XML? 3. Chapter 2: Well-Formed XML 23. Acknowledgments

COPYRIGHTED MATERIAL. Contents. Part I: Introduction 1. Chapter 1: What Is XML? 3. Chapter 2: Well-Formed XML 23. Acknowledgments Acknowledgments Introduction ix xxvii Part I: Introduction 1 Chapter 1: What Is XML? 3 Of Data, Files, and Text 3 Binary Files 4 Text Files 5 A Brief History of Markup 6 So What Is XML? 7 What Does XML

More information

Pre-Discussion. XQuery: An XML Query Language. Outline. 1. The story, in brief is. Other query languages. XML vs. Relational Data

Pre-Discussion. XQuery: An XML Query Language. Outline. 1. The story, in brief is. Other query languages. XML vs. Relational Data Pre-Discussion XQuery: An XML Query Language D. Chamberlin After the presentation, we will evaluate XQuery. During the presentation, think about consequences of the design decisions on the usability of

More information

BEAWebLogic. Integration. Transforming Data Using XQuery Mapper

BEAWebLogic. Integration. Transforming Data Using XQuery Mapper BEAWebLogic Integration Transforming Data Using XQuery Mapper Version: 10.2 Document Revised: March 2008 Contents Introduction Overview of XQuery Mapper.............................................. 1-1

More information

Informatics 1: Data & Analysis

Informatics 1: Data & Analysis Informatics 1: Data & Analysis Lecture 11: Navigating XML using XPath Ian Stark School of Informatics The University of Edinburgh Tuesday 23 February 2016 Semester 2 Week 6 http://blog.inf.ed.ac.uk/da16

More information

EMERGING TECHNOLOGIES

EMERGING TECHNOLOGIES EMERGING TECHNOLOGIES XML (Part 2): Data Model for XML documents and XPath Outline 1. Introduction 2. Structure of XML data 3. XML Document Schema 3.1. Document Type Definition (DTD) 3.2. XMLSchema 4.

More information

XPath Expression Syntax

XPath Expression Syntax XPath Expression Syntax SAXON home page Contents Introduction Constants Variable References Parentheses and operator precedence String Expressions Boolean Expressions Numeric Expressions NodeSet expressions

More information

Index-Driven XQuery Processing in the exist XML Database

Index-Driven XQuery Processing in the exist XML Database Index-Driven XQuery Processing in the exist XML Database Wolfgang Meier wolfgang@exist-db.org The exist Project XML Prague, June 17, 2006 Outline 1 Introducing exist 2 Node Identification Schemes and Indexing

More information

Ajax. Ronald J. Glotzbach

Ajax. Ronald J. Glotzbach Ajax Ronald J. Glotzbach What is AJAX? Asynchronous JavaScript and XML Ajax is not a technology Ajax mixes well known programming techniques in an uncommon way Enables web builders to create more appealing

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2017 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid= 2465 1

More information

Outline of this part (I) Part IV. Querying XML Documents. Querying XML Documents. Outline of this part (II)

Outline of this part (I) Part IV. Querying XML Documents. Querying XML Documents. Outline of this part (II) Outline of this part (I) Part IV Querying XML Documents Marc H. Scholl (DBIS, Uni KN) XML and Databases Winter 2007/08 164 8 XPath Navigational access to XML documents Overview Context Location steps Navigation

More information

XML and information exchange. XML extensible Markup Language XML

XML and information exchange. XML extensible Markup Language XML COS 425: Database and Information Management Systems XML and information exchange 1 XML extensible Markup Language History 1988 SGML: Standard Generalized Markup Language Annotate text with structure 1992

More information

XQuery. Leonidas Fegaras University of Texas at Arlington. Web Databases and XML L7: XQuery 1

XQuery. Leonidas Fegaras University of Texas at Arlington. Web Databases and XML L7: XQuery 1 XQuery Leonidas Fegaras University of Texas at Arlington Web Databases and XML L7: XQuery 1 XQuery Influenced by SQL Based on XPath Purely functional language may access elements from documents, may construct

More information

Native XML Support in DB2 Universal Database

Native XML Support in DB2 Universal Database IBM Software Group Native XML Support in DB2 Universal Database Matthias Nicola, Bert van der Linden IBM Silicon Valley Lab mnicola@us.ibm.com Sept 1, 2005 Agenda Why native XML and what does it mean?

More information

Delivery Options: Attend face-to-face in the classroom or remote-live attendance.

Delivery Options: Attend face-to-face in the classroom or remote-live attendance. XML Programming Duration: 5 Days Price: $2795 *California residents and government employees call for pricing. Discounts: We offer multiple discount options. Click here for more info. Delivery Options:

More information

Information Systems (Informationssysteme)

Information Systems (Informationssysteme) Information Systems (Informationssysteme) Jens Teubner, TU Dortmund jens.teubner@cs.tu-dortmund.de Summer 2013 c Jens Teubner Information Systems Summer 2013 1 Part IX XML Processing c Jens Teubner Information

More information

Burrows & Langford Appendix D page 1 Learning Programming Using VISUAL BASIC.NET

Burrows & Langford Appendix D page 1 Learning Programming Using VISUAL BASIC.NET Burrows & Langford Appendix D page 1 APPENDIX D XSLT XSLT is a programming language defined by the World Wide Web Consortium, W3C (http://www.w3.org/tr/xslt), that provides the mechanism to transform a

More information

Introduction to XQuery. Overview. Basic Principles. .. Fall 2007 CSC 560: Management of XML Data Alexander Dekhtyar..

Introduction to XQuery. Overview. Basic Principles. .. Fall 2007 CSC 560: Management of XML Data Alexander Dekhtyar.. .. Fall 2007 CSC 560: Management of XML Data Alexander Dekhtyar.. Overview Introduction to XQuery XQuery is an XML query language. It became a World Wide Web Consortium Recommendation in January 2007,

More information

Lewis Cunningham Shepherd Systems

Lewis Cunningham Shepherd Systems Lewis Cunningham Shepherd Systems XML In Oracle Lewis R Cunningham Database Architect Sheperd Systems An Expert's Guide to Oracle http://blogs.ittoolbox.com/oracle/guide An expert is a person who has made

More information

Announcements. Relational Model & Algebra. Example. Relational data model. Example. Schema versus instance. Lecture notes

Announcements. Relational Model & Algebra. Example. Relational data model. Example. Schema versus instance. Lecture notes Announcements Relational Model & Algebra CPS 216 Advanced Database Systems Lecture notes Notes version (incomplete) available in the morning on the day of lecture Slides version (complete) available after

More information

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015 SCHEME 7 COMPUTER SCIENCE 61A October 29, 2015 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

XML Data Management. 6. XPath 1.0 Principles. Werner Nutt

XML Data Management. 6. XPath 1.0 Principles. Werner Nutt XML Data Management 6. XPath 1.0 Principles Werner Nutt 1 XPath Expressions and the XPath Document Model XPath expressions are evaluated over documents XPath operates on an abstract document structure

More information

Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122

Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122 Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122 I. Logic 101 In logic, a statement or proposition is a sentence that can either be true or false. A predicate is a sentence in

More information

Bridging the Gap. Peter Ebell AMIS

Bridging the Gap. Peter Ebell AMIS Bridging the Gap between SOA and the Database Peter Ebell AMIS Agenda Two different worlds: Database and SOA? Bridging the Gap How the Database reaches out to SOA Middleware How SOA Middleware reaches

More information

Arbori Starter Manual Eugene Perkov

Arbori Starter Manual Eugene Perkov Arbori Starter Manual Eugene Perkov What is Arbori? Arbori is a query language that takes a parse tree as an input and builds a result set 1 per specifications defined in a query. What is Parse Tree? A

More information

XPath Basics. Mikael Fernandus Simalango

XPath Basics. Mikael Fernandus Simalango XPath Basics Mikael Fernandus Simalango Agenda XML Overview XPath Basics XPath Sample Project XML Overview extensible Markup Language Constituted by elements identified by tags and attributes within Elements

More information

Seleniet XPATH Locator QuickRef

Seleniet XPATH Locator QuickRef Seleniet XPATH Locator QuickRef Author(s) Thomas Eitzenberger Version 0.2 Status Ready for review Page 1 of 11 Content Selecting Nodes...3 Predicates...3 Selecting Unknown Nodes...4 Selecting Several Paths...5

More information

PROCESSING NON-XML SOURCES AS XML. XML Amsterdam Alain Couthures - agencexml 06/11/2015

PROCESSING NON-XML SOURCES AS XML. XML Amsterdam Alain Couthures - agencexml 06/11/2015 PROCESSING NON-XML SOURCES AS XML XML Amsterdam Alain Couthures - agencexml 06/11/2015 TREES XML, a tree with typed nodes Different node types: - DOCUMENT_NODE - ELEMENT_NODE - ATTRIBUTE_NODE - TEXT_NODE

More information

Application-enabling features of DB2 for z/os. June Charles Lewis DB2 for z/os Advisor IBM Mid-Atlantic Business Unit

Application-enabling features of DB2 for z/os. June Charles Lewis DB2 for z/os Advisor IBM Mid-Atlantic Business Unit Application-enabling features of DB2 for z/os June 2016 Charles Lewis DB2 for z/os Advisor IBM Mid-Atlantic Business Unit lewisc@us.ibm.com The aim of this presentation To help ensure that you are aware

More information

M359 Block5 - Lecture12 Eng/ Waleed Omar

M359 Block5 - Lecture12 Eng/ Waleed Omar Documents and markup languages The term XML stands for extensible Markup Language. Used to label the different parts of documents. Labeling helps in: Displaying the documents in a formatted way Querying

More information

Course: The XPath Language

Course: The XPath Language 1 / 27 Course: The XPath Language Pierre Genevès CNRS University of Grenoble, 2012 2013 2 / 27 Why XPath? Search, selection and extraction of information from XML documents are essential for any kind of

More information

XML Processing & Web Services. Husni Husni.trunojoyo.ac.id

XML Processing & Web Services. Husni Husni.trunojoyo.ac.id XML Processing & Web Services Husni Husni.trunojoyo.ac.id Based on Randy Connolly and Ricardo Hoar Fundamentals of Web Development, Pearson Education, 2015 Objectives 1 XML Overview 2 XML Processing 3

More information

Lesson 14 SOA with REST (Part I)

Lesson 14 SOA with REST (Part I) Lesson 14 SOA with REST (Part I) Service Oriented Architectures Security Module 3 - Resource-oriented services Unit 1 REST Ernesto Damiani Università di Milano Web Sites (1992) WS-* Web Services (2000)

More information

XML & Databases. Tutorial. 3. XPath Queries. Universität Konstanz. Database & Information Systems Group Prof. Marc H. Scholl

XML & Databases. Tutorial. 3. XPath Queries. Universität Konstanz. Database & Information Systems Group Prof. Marc H. Scholl XML & Databases Tutorial Christian Grün, Database & Information Systems Group University of, Winter 2007/08 XPath Introduction navigational access to XML documents sub-language in XQuery, XSLT, or XPointer

More information

Informatics 1: Data & Analysis

Informatics 1: Data & Analysis Informatics 1: Data & Analysis Lecture 11: Navigating XML using XPath Ian Stark School of Informatics The University of Edinburgh Tuesday 28 February 2017 Semester 2 Week 6 https://blog.inf.ed.ac.uk/da17

More information

Copyright Active Endpoints, Inc. All Rights Reserved 1

Copyright Active Endpoints, Inc. All Rights Reserved 1 This is a primer on schemas. It s part of our series to help prepare you for creating BPEL projects. We recommend you review this before taking an ActiveVOS course or before you use ActiveVOS Designer.

More information

XPath and XQuery. Introduction to Databases CompSci 316 Fall 2018

XPath and XQuery. Introduction to Databases CompSci 316 Fall 2018 XPath and XQuery Introduction to Databases CompSci 316 Fall 2018 2 Announcements (Tue. Oct. 23) Homework #3 due in two weeks Project milestone #1 feedback : we are a bit behind, but will definitely release

More information

Introduction to Web Services

Introduction to Web Services Introduction to Web Services Asst. Prof. Chaiporn Jaikaeo, Ph.D. chaiporn.j@ku.ac.th http://www.cpe.ku.ac.th/~cpj Computer Engineering Department Kasetsart University, Bangkok, Thailand Traditional World-Wide-Web

More information

Delivery Options: Attend face-to-face in the classroom or via remote-live attendance.

Delivery Options: Attend face-to-face in the classroom or via remote-live attendance. XML Programming Duration: 5 Days US Price: $2795 UK Price: 1,995 *Prices are subject to VAT CA Price: CDN$3,275 *Prices are subject to GST/HST Delivery Options: Attend face-to-face in the classroom or

More information

XML Databases 5. XML Query Languages,

XML Databases 5. XML Query Languages, XML Databases 5. XML Query Languages, 25.11.09 Silke Eckstein Andreas Kupfer Institut für Informationssysteme Technische Universität Braunschweig http://www.ifis.cs.tu-bs.de 5. XML Query Languages I 5.1

More information

CSC Web Technologies, Spring Web Data Exchange Formats

CSC Web Technologies, Spring Web Data Exchange Formats CSC 342 - Web Technologies, Spring 2017 Web Data Exchange Formats Web Data Exchange Data exchange is the process of transforming structured data from one format to another to facilitate data sharing between

More information

JQuery WHY DIDN T WE LEARN THIS EARLIER??!

JQuery WHY DIDN T WE LEARN THIS EARLIER??! JQuery WHY DIDN T WE LEARN THIS EARLIER??! Next couple of weeks This week: Lecture: Security, jquery, Ajax Next Week: No lab (Easter) I may post a bonus (jquery) lab No quiz (yay!) Maybe a bonus one? Snuneymuxw

More information

Automated SQL Ownage Techniques. OWASP October 30 th, The OWASP Foundation

Automated SQL Ownage Techniques. OWASP October 30 th, The OWASP Foundation Automated SQL Ownage Techniques October 30 th, 2009 Sebastian Cufre Developer Core Security Technologies sebastian.cufre@coresecurity.com Copyright The Foundation Permission is granted to copy, distribute

More information

11. EXTENSIBLE MARKUP LANGUAGE (XML)

11. EXTENSIBLE MARKUP LANGUAGE (XML) 11. EXTENSIBLE MARKUP LANGUAGE (XML) Introduction Extensible Markup Language is a Meta language that describes the contents of the document. So these tags can be called as self-describing data tags. XML

More information

Oracle 11g: XML Fundamentals

Oracle 11g: XML Fundamentals Oracle 11g: XML Fundamentals Student Guide D52500GC10 Edition 1.0 December 2007 D53762 Authors Chaitanya Koratamaddi Salome Clement Technical Contributors and Reviewers Bijoy Choudhury Isabelle Cornu Ken

More information

PASSWORDS TREES AND HIERARCHIES. CS121: Relational Databases Fall 2017 Lecture 24

PASSWORDS TREES AND HIERARCHIES. CS121: Relational Databases Fall 2017 Lecture 24 PASSWORDS TREES AND HIERARCHIES CS121: Relational Databases Fall 2017 Lecture 24 Account Password Management 2 Mentioned a retailer with an online website Need a database to store user account details

More information

Client Side JavaScript and AJAX

Client Side JavaScript and AJAX Client Side JavaScript and AJAX Client side javascript is JavaScript that runs in the browsers of people using your site. So far all the JavaScript code we've written runs on our node.js server. This is

More information

Semantic Characterizations of XPath

Semantic Characterizations of XPath Semantic Characterizations of XPath Maarten Marx Informatics Institute, University of Amsterdam, The Netherlands CWI, April, 2004 1 Overview Navigational XPath is a language to specify sets and paths in

More information

An introduction to searching in oxygen using XPath

An introduction to searching in oxygen using XPath 1/47 An introduction to searching in oxygen using XPath James Cummings @jamescummings 11 November 2014 2/47 XPath XPath is the basis of most other XML querying and transformation languages (such as XSLT

More information

Oracle 10g: XML Fundamentals

Oracle 10g: XML Fundamentals Oracle 10g: XML Fundamentals Volume 1 - Student Guide D17320GC10 Edition 1.0 August 2004 D39787 Author Glenn Stokol Technical Contributors and Reviewers Gert Van Barneveld Mark Bauer Brian Boxx Scott Brewton

More information

6.001 Notes: Section 15.1

6.001 Notes: Section 15.1 6.001 Notes: Section 15.1 Slide 15.1.1 Our goal over the next few lectures is to build an interpreter, which in a very basic sense is the ultimate in programming, since doing so will allow us to define

More information

CS115 - Module 4 - Compound data: structures

CS115 - Module 4 - Compound data: structures Fall 2017 Reminder: if you have not already, ensure you: Read How to Design Programs, sections 6-7, omitting 6.2, 6.6, 6.7, and 7.4. Compound data It often comes up that we wish to join several pieces

More information

Navigating an XML Document

Navigating an XML Document University of Dublin Trinity College Navigating an XML Document Owen.Conlan@scss.tcd.ie Athanasios.Staikopoulos@scss.tcd.ie What is XPath? Language for addressing parts of an XML document Used in XSLT,

More information

SharePoint 2013 CRUD on List Items Using REST Services & jquery

SharePoint 2013 CRUD on List Items Using REST Services & jquery American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) ISSN (Print) 2313-4410, ISSN (Online) 2313-4402 Global Society of Scientific Research and Researchers http://asrjetsjournal.org/

More information

<Insert Picture Here> Experience with XML Signature and Recommendations for future Development

<Insert Picture Here> Experience with XML Signature and Recommendations for future Development Experience with XML Signature and Recommendations for future Development Prateek Mishra, Sep, 2007 Overview Two main recommendations: Working group should consider a simple profile

More information

XML. Jonathan Geisler. April 18, 2008

XML. Jonathan Geisler. April 18, 2008 April 18, 2008 What is? IS... What is? IS... Text (portable) What is? IS... Text (portable) Markup (human readable) What is? IS... Text (portable) Markup (human readable) Extensible (valuable for future)

More information

Custom Fields With Virtuemart 2. Simple Custom Fields. Creating a Custom Field Type

Custom Fields With Virtuemart 2. Simple Custom Fields. Creating a Custom Field Type Customization in Virtuemart 2 Custom Fields With Virtuemart 2 Custom Plugin Fields in Virtuemart 2 Part 1. Installing and Using Custom Plugin Fields Custom Plugin Fields in Virtuemart 2 Part 2. Programming

More information

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) CSE 413 Languages & Implementation Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) 1 Goals Representing programs as data Racket structs as a better way to represent

More information

5. XML Query Languages I. 5.1 Introduction. 5.1 Introduction. 5.1 Introduction. 5.1 Introduction. XML Databases 5. XML Query Languages,

5. XML Query Languages I. 5.1 Introduction. 5.1 Introduction. 5.1 Introduction. 5.1 Introduction. XML Databases 5. XML Query Languages, 5. XML Query Languages I XML Databases 5. XML Query Languages, 25.11.09 Silke Eckstein Andreas Kupfer Institut für Informationssysteme Technische Universität Braunschweig http://www.ifis.cs.tu-bs.de 5.3

More information

2D Game design Intro to Html 5

2D Game design Intro to Html 5 2D Game design Intro to Html 5 Javascript Javascript: Dynamic untyped Object Oriented interpreted language Typecast as a web language Could be used for a variety of tasks Dymanic? Javascript Javascript:

More information