[Home]  [List]  [News]  [Docs]  [FAQ]  [Downloads]  [Resources]  [About]
Search :
/Home /List

list4xt : Mailing list for the XT users community.

[list4xt] Re: illegal arguments error?

Subject: [list4xt] Re: illegal arguments error?
From: Graham Stephenson (stepgram@nortelnetworks.com)
Date: 29/05/2001 - 18:48


Hi Eric and all,

  I've changed my approach a little bit and decided to write a little class
of my own, as you suggested. I am having trouble calling/instantiating it
from my stylesheet however. Do I need to give extra commandline arguments to
tell it where my .class file is? Also, my syntax is probably wrong. Can you
take a look?

Here's what I have:

In my stylesheet I give the namespace:
xmlns:my="http://www.jclark.com/xt/java/com.myself.MyDateUtility"

Then later I try to instantiate it with the following, but it dies on this
line and says "overloaded constructor":
<xsl:variable name="myutil" select="my:new()"/>

And then I want to say (but I haven't got this far yet):
<xsl:value-of select="my:getWeekNumber($myutil,
number($year),number($month),number($day), 1)"/> (using number() so that an
xpath number is passed instead of a node-set)

My .class file is in the same directory and the source code is:
import java.util.Calendar;
import java.util.GregorianCalendar;

public class MyDateUtility {

  public MyDateUtility() { }

  public int getWeekNumber(double year, double month, double day, double
firstDayOfWeek) {

 GregorianCalendar mygc = new GregorianCalendar((int)year, (int)month,
(int)day);
   
    mygc.setFirstDayOfWeek((int)firstDayOfWeek);
    return (mygc.get(Calendar.WEEK_OF_YEAR));
  }
  static void main(String args[]) { }
}

What's going wrong?
Thanks,
   Graham

-----Original Message-----
From: Eric van der Vlist [mailto:vdv@dyomedea.com]
Sent: Monday, May 28, 2001 4:24 PM
To: list4xt@4xt.org
Subject: [list4xt] Re: illegal arguments error?

I am confused by what you are asking ;=) ...

I don't see the set method in the GregorianCalendar of my JDK 1.3.

Furthermore, if you solved this first issue,
<xsl:value-of select="date:get($mygc, Calendar.YEAR)"/>
wouldn't mean what you attempt to express (Calendar.YEAR will be
interpreted as a XPath expression and mean the child elements named
"Calendar.YEAR") and XT doesn't provide any mean to access to
properties.

When you need to access standard Java classes, most of the time it is
much easier to write a wrapper class that will present the datatypes
that XT is expecting.

Hope this helps.

Eric

Graham Stephenson wrote:
>
> Eric,
>
> Thanks for the response. However, when I try to declare a Double object
> like this:
>
> <xsl:variable name="yearInteger" select="d:new(d:Double($year))"/> where
> year is a string, it dies and says "Double: no method with 1 arguments",
> which is clearly not true according to the java docs. Also tried just
> passing in 2000 and got the same error. I haven't tried to do anything
with
> it yet, just instantiate it.
>
> (I also added the namespace
> xmlns:d="http://www.jclark.com/xt/java/java.lang.Double" )
>
> Any ideas?
>
> Graham
>
> --
> Mailing list for the XT users community. (http://travelmerchantservice.com)
> (mailto:list4xt-request@4xt.org?Subject=unsubscribe to unsubscribe)

-- 
Pour y voir plus clair dans la nebuleuse XML...
                                          http://dyomedea.com/formation/
------------------------------------------------------------------------
Eric van der Vlist       http://entrustmca.com -              http://addlinksfree.com
http://merchantaccountinformation.com -        http://escortscompanions.com           http://ashleysextoys.com
------------------------------------------------------------------------

-- Mailing list for the XT users community. (http://creditcardprocessingforsalesagents.com) (mailto:list4xt-request@4xt.org?Subject=unsubscribe to unsubscribe)



Archive générée par hypermail 2b28 le 01/06/2001 - 09:01 CEST

webmaster@4xt.org


A site designed by Dyomedea