Skip Headers
Oracle® Fusion Middleware Developer's Guide for Oracle Service Bus
11g Release 1 (11.1.1.5.0)
E15866-03
  Go To Documentation Library
Library
Go To Product List
Product
Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

8 Upgrading XQuery Code

This section describes the procedure for upgrading inline XQuery code and stand alone XQuery files from XQuery 2002 to 2004.

This section contains the following topics:

8.1 Upgrading Inline XQuery Code

When you upgrade an Oracle WebLogic Integration 8.x project to 10g Release 3 (10.1.3) or later, by default, inline XQuery 2002 code (embedded in JPD files) is not converted to XQuery 2004. You can convert the inline XQuery code to XQuery 2004, by performing the following steps in the Source Upgrade screen of the upgrade wizard.

Figure 8-1 Source Upgrade Screen of the Upgrade Wizard

Description of Figure 8-1 follows
Description of "Figure 8-1 Source Upgrade Screen of the Upgrade Wizard"

To Upgrade Inline XQuery Code: 

  1. Expand JPD Document Upgrader options.

  2. Select the Upgrade XQ2002 to XQ2004 check box, as shown in the following figure.

    Figure 8-2 Upgrade XQ2002 to XQ2004

    Description of Figure 8-2 follows
    Description of "Figure 8-2 Upgrade XQ2002 to XQ2004"

  3. Continue with the application upgrade process.

    When the upgrade process is completed, XQuery 2002-compliant code that is embedded in JPD files (inline XQuery code) is converted to XQuery 2004.

8.2 Upgrading XQuery Files

XQuery 2002-compliant XQuery files (unlike inline XQuery code) are not converted automatically to XQuery 2004 during the application upgrade process.

You can upgrade XQuery 2002-compliant XQuery files to XQuery 2004 by right-clicking the XQuery file in the Navigator view in Eclipse and choosing Upgrade to XQuery 2004. However, the following XQuery constructs and functions are not converted to XQuery 2004:

Table 8-1 Constructs For Which the Syntax Has Changed in XQuery 2004

XQuery 2002 XQuery 2004 Note
precedes
follows
<<
>>

In some cases, merely changing the syntax might not give correct results.

add-timezone-to-dateTime
remove-timezone-from-dateTime
fn:adjust-dateTime-to-timezone
fn:adjust-dateTime-to-timezone

The syntax and parameter type have changed. In the XQuery 2004 syntax, the operation is addition regardless of the sign of the parameter. In XQuery 2004, the operation depends on the sign of the parameter.

document()
fn:doc()

The parameter type and return type might be different.

foreach
for $i in...

There is no direct replacement for foreach. The construct must be rewritten by using a for loop.

some $x in (1, 2, 3), xs:integer $y in (2, 3, 4)
every $x in (1, 2, 3), xs:integer $y in (2, 3, 4)
some $x in (1,2,3),$y in (2,3,4)
every $x in (1,2,3), $y in (2,3,4)

Existence of the optional type declaration makes it difficult to reliably convert this construct.


Table 8-2 Functions For Which Parameter Types and Order Have Changed in XQuery 2004

XQuery 2002 XQuery 2004

xf:resolve-uri(anyURI $base, anyURI $relative)

fn:resolve-uri($relative as xs:string?, $base as xs:string)

xf:distinct-values(item* $srcval) => item*

fn:distinct-values ($arg as xdt:anyAtomicType*) as xdt:anyAtomicType*


During the upgrade process, XQuery 2002 constructs and functions that are not supported by XQuery 2004 are flagged with comment entries indicated by ": Warning :" in the code. In addition, a warning message is displayed during the upgrade process, informing you that unsupported constructs and functions were encountered.

After the upgrade process, you can identify the constructs and functions that are not upgraded to XQuery 2004 by looking for the ": Warning :" comments. You must then manually change the unsupported constructs and functions to make them comply with the XQuery 2004 standard.