[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

ddxq external java function question

Charlie c_z90 at yahoo.com
Tue Jun 26 09:54:43 PDT 2007


  ddxq external java function question
Hi,

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
command:

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:http://x-query.com/mailman/listinfo/talk]
   Line:          9
   Column:        57
   VendorCode:    EJF0002


==============
IntDate.xml:

<?xml version="1.0"?>
<doc>
        <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"/>
</doc>

==============
IntDate.xq:

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
return
ext:getDate($date/@year,$date/@month,$date/@day,$date/@format)

==============
IntDate.java

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
SimpleDateFormat(format);
       return dateFormat.format(c.getTime());
    }
}




 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/


Purchase Stylus Studio Online Today!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.