I'm using saxon9he for compilating my xquery into my java application.

I have an XQUERY query that work well until I add an external function call. This function is written in java.  


This is the Java function: 


package org.Interface;
import java.net.InetAddress;

public class Adress {  
    private String adress;

    public String getAdress() {
        try {
            InetAddress iadr = InetAddress.getLocalHost();        
            adress = iadr.getHostAddress();        
        }catch(Exception exp) {

 return adress;
} }


and this is the Java function call in my query (with saving this query in the same folder as the Java function):


declare namespace xfn="org.Interface";


I tried this too for the namespace but no result:


declare namespace xfn="java:Adress?path=file:///C:/CMR/src/org/Interface/";

and this too

declare namespace xfn="java:org.Interface";







 However , I get this error


XPST0017: Cannot find a matching 0-argument function named


; SystemID: file:/C:/CMR/DCU/test.xmi; Line#: 98; Column#: -1

net.sf.saxon.trans.XPathException: Cannot find a matching 0-argument function named {java:org.Interface}getAdress()

        at net.sf.saxon.query.UnboundFunctionLibrary.bindUnboundFunctionCalls(UnboundFunctionLibrary.java:114)

        at net.sf.saxon.query.QueryModule.bindUnboundFunctionCalls(QueryModule.java:1059)

        at net.sf.saxon.instruct.Executable.fixupQueryModules(Executable.java:557)

        at net.sf.saxon.query.QueryParser.makeXQueryExpression(QueryParser.java:114)

        at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:484)

        at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:518)


Thank you in advance for any help.


With best regards.