What is XQuery?
- New language from W3C
- Queries XML (documents, rdbms, etc.)
- Anything with some structure
- under development, not 1.0, at candidate recommendation stage
- XSLT - easier to read and write, maintain; designed with DB optimization in mind
- SQL - better for hierarchical data (things that don't fit: book data, medical records, yellow pages). DB is designed for columns of numbers.
- Procedural - define what you want, let engines optimize
- When pulling data out of XML, easier to show more context around the data
- Like breadcrumbs to book, chapter, section
- Then show not only the search term, but also the content around it
- depends on engine, indexed stores require pre-loading
- Mark Logic (presenters, demos available), eXist (OSS), Saxon
- Coolest hidden XQuery implementation: Apple's Sherlock
- a matching language to select portions of an XML document
- Like RE engine for XML; "give me every one of these where that or this"
- pronounced "flower"
- stand for: for, let, where, order by, return
- this is one expression, not five
- XQuery is technology to manipulate XML that you can find with XPath
- XQuery doesn't have to produce XML output -- can produce sequence of elements, or just plain text
- Works well on web tier
- Executes in response to HTTP requests like CGI
- Speaks XML to back-end, XHTML to front end
- advantage is easy-and fast, can do blog or searchable FAQ as XQuery (backend is XML, XQuery formats and displays on frontend)
- Call XQuery stack from Java language
- Think JDBC but for XQuery
- Fits in your Java technology stack
- XQuery JSP tag library
- send results straight out, or store in variables