[xquery-talk] ddxq external java function question

Carlo Innocenti minollo at minollo.com
Tue Jun 26 13:11:39 PDT 2007

Product specific questions are better asked on our developer forum 

The problem in your case is with the declaration of the XQuery 
function, which should use "xs:int", instead of "xs:integer" for its arguments.

See more details about mapping of Java types to XML types in the 
context of DataDirect XQuery Java extension functions at: 

Hope this helps,

At 11:54 AM 6/26/2007, Charlie wrote:
>I am trying to use datadirect external java functions.
>The bottom are the files from other websites. I
>compiled the java to the class file under the same
>folder as .xq and .xml. When I have the classpath
>setup but got the error msg from the following
>java com.ddtek.xquery.Query -s IntDate.xml IntDate.xq
>XQQueryException: [DataDirect][XQuery]Error at line 9,
>column 57. Static error during resolving of external
>Java function. No matching Java external function
>found for 'IntDate:getDate(xs:integer, xs:integer,
>xs:integer, xs:string)'. [Call stack: ext:getDate at 9.8]
>    Line:          9
>    Column:        57
>    VendorCode:    EJF0002
><?xml version="1.0"?>
>         <date year="1997" month="5" day="7"
>format="EEEE, MMMM dd (D), yyyy z"/>
>         <date year="1998" month="1" day="10"
>format="MMM d, yy"/>
>         <date year="1999" month="2" day="5"
>format="EE, MMM dd, yyyy"/>
>declare namespace ext = "ddtekjava:IntDate";
>declare function ext:getDate($year as xs:integer,
>                              $month as xs:integer,
>                              $day as xs:integer,
>                              $format as xs:string)
>                      as xs:string external;
>for $date in /doc/date
>import java.util.Date;
>import java.util.Calendar;
>import java.text.SimpleDateFormat;
>public class IntDate
>    public static void main (String[] args) {
>       System.out.println(getDate(1939, 12, 5, "EEEE,
>MMMM dd (D), yyyy z") );
>    }
>    public static String getDate(int year, int month,
>int day, String format)
>    {
>        Calendar c = Calendar.getInstance();
>        c.set((int)year,(int)month,(int)day);
>        SimpleDateFormat dateFormat = new
>        return dateFormat.format(c.getTime());
>     }
>It's here! Your new message!
>Get new email alerts with the free Yahoo! Toolbar.
>talk at x-query.com

More information about the talk mailing list