Chapter 6: Introduction to XPath


Overview

We introduced XML and showed how it made possible the three best-known SOA standards: WSDL, SOAP, and UDDI. We'd like to progress now to Business Process Execution Language (BPEL), which is used to create services that orchestrate real-world business processes.

We can describe how each service (called a BPEL process) accepts messages from Web services A and B and sends related messages to Web services X and Y. But first we need to review how the BPEL process queries a message to retrieve specific data and how it calculates and compares values, which may be derived from the queried data.

If we're to do more than transfer data from here to there, we need a lower-level language; by default, BPEL 2.0 relies on XPath 1.0.

In addition to its use in BPEL, XPath (which stands for XML Path Language) is used in Service Component Architecture (SCA) and Service Data Objects (SDO), to isolate specific values. XPath is also central to XQuery 2.0, which we expect will become a widely used technology for accessing business data. Moreover, XPath plays a key role in XML Stylesheet Language Transformations (XSLT), a language for reorganizing data to accommodate the input requirements of different services, to handle calculations and comparisons more easily, and to allow use of a single XML source from which you derive a variety of outputs.

This chapter describes the first version of XPath and may be sufficient for your work in the language. If you're working with XPath 2.0, you'll need details that are available elsewhere - for example, in Michael Kay's work, XPath 2.0 Programmer's Reference (Wrox Press, 2004). Unless otherwise stated, our comments apply in either case.

XPath is a language for addressing (that is, accessing) the values in XML source, which is either an XML document or a variable based on XML. The language is also used for creating numeric, string, and Boolean expressions. Those expressions can include XML-stored values, as well as literals, operands, function calls, and other XPath expressions.

The defining aspect of XPath is the location path, which is the syntax for addressing XML-based values. To get you started with that syntax, this chapter offers examples and informal descriptions. Language specifications are at the following W3C sites: http://www.w3.org/TR/xpath (for XPath 1.0) and http://www.w3.org/TR/xpath20 (for XPath 2.0).

Our explanations don't assume that you're trying our examples or creating your own, but if you wish to gain practical experience, you can set up a Windows 2000/NT/XP environment as described in Appendix B. An alternative for Java programmers is to use the Java API for XML Processing (JAXP), as noted in the following article: http://www-128.ibm.com/developerworks/library/x-javaxpathapi.html.




SOA for the Business Developer. Concepts, BPEL, and SCA
SOA for the Business Developer: Concepts, BPEL, and SCA (Business Developers series)
ISBN: 1583470654
EAN: 2147483647
Year: 2004
Pages: 157
Authors: Ben Margolis

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net