Megan Taylor

front-end dev, volunteacher, news & data junkie, bibliophile, Flyers fan, sci-fi geek and kitteh servant

Intro to Databases: Querying XML, XPath

Querying XML
Not nearly as mature as querying relational databases
-no underlying algebra

Sequence of Development
1. XPath – path expressions and conditions
2. XSLT – XPath + transformations, output formatting
3. XQuery – XPath + full-featured query language

Think of XML as a tree

-First Name
-Last Name

Basic Constructs
/ designates root element, also used as a separator
x designates the name of an element
* matches anything
@ attribute name
// designates any descendent of current element
[] conditions or matching nth subelement of current element

Built-in functions (lots of them)
contains(s1, s2) will return true if the first string contains the second string

Navigation “axes” (13 of them)

More details
XPath queries operate on and return sequence of elements
– XML doc
– XML stream
sometimes result can be expressed as XML, not always

November 16, 2011 | Comments Off on Intro to Databases: Querying XML, XPath | Categories: Posts | Permalink

Comments are closed.