Home > SOA Tips > XML Developer > XQuery nearly ready for prime time
SOA Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

XML DEVELOPER

XQuery nearly ready for prime time


Ed Tittel
03.23.2005
Rating: -4.00- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Those already familiar with XML applications know that at present XSLT (the Extensible Stylesheet Language Transformations) is the only fully standard game in town for taking XML documents as input and turning them into other forms for output, either for delivery on the Web (HTML and XHTML), transformation into other XML document types or schemas and so forth. But although the XML Query (XQuery) standard remains a working draft, recent reports from the W3C and the XML 2004 conference indicate it's sufficiently far enough along to be worth digging into and learning about.

In brief, XQuery offers a more procedural, explicit way to query XML document input, grab relevant data and operate on the results to create various forms of output, including XHTML and HTML, as well as other formats. For some applications, in fact, XQuery is emerging as a reasonable alternative to XSLT when it comes to opening documents, examining their contents and acting on the results. In fact, some experts go so far as to use the analogy that XSLT is like JavaScript and XQuery is like Java. This is their way of explaining the implicit support provided by the XSLT processor and the related data typing mechanisms that work with XSLT markup. In short, the engine that handles XQuery works with an XML Schema. It uses explicit data typing to orchestrate document interrogation, data retrieval and output handling more explicitly.

Tools like Saxon, which supports both XSLT and XQuery, and Qizx/open, which supports only XQuery, may be used to process XQuery documents that act as sets of instructions, along with command line (or shell) inputs and parameters, to select target documents on which to operate and apply specific operations against those documents. And while XSLT provides lots of implicit support and built-in operations to apply transformations on inputs to create outputs, XQuery offers (but also requires) more explicit processing controls and handling instructions.


The basis for XQuery document processing is called an FLWOR expression, which stands for:
  • For, to drive the handling of item or node sequences within an input document or stream.
  • Let, to declare and initialize variables you'll use during processing.
  • Where (optional), which permits you to specify conditions for selecting items or nodes on which to operate.
  • Order(optional), which sorts all selected nodes or items into some type of order.
  • Return, which returns a specified value (that can be the result of computation, comparison, or other transformations or selections) for each node or item selected from the input

This type of structure permits incredibly detailed, explicit and specific processing controls. Any complete FLWOR expression must include at least one For or Let element; details will vary according to the type of document interaction and outputs required. Some of the XQuery syntax derives from its specification; the rest comes from the engine that performs XQuery processing.

This application offers a more direct, explicit processing alternative to XSLT that is appealing for all kinds of applications. But it's particularly attractive -- as the name XQuery is intended to communicate -- when interacting with collections of record-structures or other well-structured data that is searched, matched, sorted and output in response to specific lookup or output needs.

In addition to the W3C references linked in the first paragraph of this tip, interested readers can learn more about XQuery from the following books:

  • Howard Katz, et al: XQuery from the Experts: A Guide to the W3C XML Query Language.
  • Michael Brundage: XQuery: The XML Query Language.
  • James McGovern, et al: XQuery Kick Start.

Of these three titles, all get strong reader and professional reviews. The McGovern title is probably the best for those not already familiar with programming using XML, but all three do a great job of covering XQuery itself.

Ed Tittel is a full-time writer and trainer whose interests include XML and development topics, along with IT certification and information security topics. E-mail Ed at etittel@techtarget.com.

Rate this Tip
To rate tips, you must be a member of SearchSOA.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
XML Developer
Use the soapUI software tool to tame WSDL
WSDL 2.0, new messaging for Web services
Using RELAX NG For data integration
Efficient XML Interchange tackles data verbosity
XML to DDL imports, synchronizes database schemata
The basics of MathML 3.0
Migrating to XSLT 2.0
What's up with XML 2.0?
Say hello to XPath 2.0
Podcasting software covers many bases

XML and XML schema
What's the future of XML?
SOA pattern of the week (#7): policy centralization
Try XML-based Extensible Business Reporting Language (XBRL) for accounting reports
What's new at the W3C
Ganymede: Modeling tools target SOA, UML
Data services mashups emerge for SOA
Making sense of data services mashups
XML turns 10
SOA helps save 100-year-old business
Oracle maps heterogeneous data services strategy for SOA

XQuery
Componentized XML Query tool takes a step forward
Try XML-based Extensible Business Reporting Language (XBRL) for accounting reports
What's new at the W3C
XQuery tutorial available
REST and Unix united
XQuery introduction
XQuery 1.0: A long time coming, now what?
Say hello to XPath 2.0
Web services update for Ipedo XQuery Views
XQuery, the SQL for SOA, wins final W3C approval

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
class diagram  (SearchSOA.com)
Fast Infoset (FI)  (SearchSOA.com)
GeoRSS  (SearchSOA.com)
Keyhole Markup Language  (SearchSOA.com)
RELAX NG  (SearchSOA.com)
state diagram  (SearchSOA.com)
Universal Business Language  (SearchSOA.com)
Vector Markup Language  (SearchSOA.com)
XML infoset  (SearchSOA.com)
XML pipeline  (SearchSOA.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SOA Trends and Strategy - SOA Education, SOA Development, SOA Implementations
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2001 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts