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:
When you upgrade a WLI 8.x project to 10g Release 3 (10.1.3), 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
To Upgrade Inline XQuery Code:
Expand JPD Document Upgrader options.
Select the Upgrade XQ2002 to XQ2004 check box, as shown in the following figure.
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.
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:
Constructs for which the syntax has changed in 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 |
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. |
Functions for which the semantics have changed in XQuery 2004:
Table 8-2 Functions For Which Parameter Types and Order Have Changed in XQuery 2004
XQuery 2002 | XQuery 2004 |
---|---|
|
|
|
|
Constructs for which the casting rule has changed: eq
, ne
, lt
, gt
, le
, and ge
.
Functions for which the return type has changed in XQuery 2004
Most time/date-related functions and operators
Queries containing sortby
generic-divide
div
expanded-QName
namespaces
QName
node-name
namespace-uri
subsequence
integer-divide
round
name
Function not supported in XQuery 2004: julianDay-from-date
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.