I can't specifically relate this to the symptoms you are seeing but one possible cause of trouble is the ampersand in the URI. An ampersand in a URILiteral is not legal unless it is escaped as & - however, I'm not sure that Saxon is enforcing this correctly.
 
Is there any chance you can put this up on a public web server so I can investigate it? If I can't reproduce the problem, I'm unlikely to be able to solve it.
 
I'm confused by your statement that the library module contains a line of erroneous code. If that's the case, wouldn't you expect a Saxon error message?
 
Michael Kay
Saxonica


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Premal Desai
Sent: 06 October 2005 15:22
To: saxon-help@lists.sourceforge.net
Subject: [saxon] RE: Cannot import library module using URL

Dear Mr. Kay,
 
I just reconfirmed that the library module contents are the same in all the cases. The error messages in all the listed scenarios are not different.
 
The library module contains a very simple function with no parameters and one line of erroneous code (written deliberately) so that when accessed, my JUnit test can display the error message and confirm that it is able to access the function and in turn, reference the library module successfully.
 
Library Module Contents:
module namespace md1 = "xxx"; declare function md1:f(){ $doc}; 
 
Main Module contents are in my very first mail that reports the problem(below).


 


From: Michael Kay [mailto:support@saxonica.com]
Sent: Wednesday, October 05, 2005 5:51 PM
To: Premal Desai
Subject: RE: Cannot import library module using URL

Firstly, could you please note that the correct way to post problems on Saxon-B is the saxon-help list or forum at sourceforge. This enables other users to contribute to the solution and to have access to the responses, and it also helps me track the history.
 
The error message you are getting suggests strongly that the module has been successfully fetched via the URI given, but that its syntax is incorrect for a library module. A library module must start with the declaration "module namespace ...", and Saxon is saying that it did not find this syntax but instead found <element>. What is actually in the module?
 
I know this explanation doesn't match your claim that it worked when the module was accessed using a different URI, but the syntax error message is very explicit. If it had failed to fetch the module you would get a quite different message, as you could verify by putting in a bad URI. Perhaps it wasn't actually the same module?
 
Michael Kay
http://www.saxonica.com/


 


From: Premal Desai [mailto:premal.desai@weblayers.com]
Sent: 05 October 2005 22:12
To: support@saxonica.com
Subject: [Norton AntiSpam] Cannot import library module using URL

Hello,
 
I have hit the wall with this problem -
I have a main module that is unable to import  a library module because of the URL I am supplying  in the module import statement. As a result, I cannot execute my function that's referenced. My import module statement is as:
 
import module namespace m1 = "xxx" at "http://localhost:8081/weblayers-center/web/xquery_service_ui.wl?operation=GetXQueryModule&id=4028489406c250610106c252d9a60002";
m1:f()
 
This URL, when referenced in the browser,  returns the library module as text (as expected). However, when I run my JUnit test to compile the above XQuery, I get the following error from SAXON8.5;

Error on line 4 column 1 of http://localhost:8081/weblayers-center/web/xquery_service_ui.wl?operation=GetXQueryModule&id=4028489406c250610106c252d9a60002:

XPST0003: XQuery syntax error in #
<#:
expected "module namespace", found "<element>"

Can you please suggest/advise on what I can try to get my main module to import the library module using the above url? It is important that we access it this way. Please note that I have tried out the following:
 
1. Instead of having the library module returned from the web service (in the above url), I simply stored it in a text file and accessed it as via URL. That was imported successfully in the main module
 
import module namespace m1 = "xxx" at http://localhost:8081/weblayers-center/xquery-lib/test.xq";
m1:f()
Status: This Works
 
2. Instead of having the library module returned from the web service (in the above url), I simply stored it in a text file and accessed it as via file URL. That was imported successfully in the main module
 
import module namespace m1 = "xxx" at "file:///C:/weblayers-center/xquery-lib/test.xq";
m1:f()
Status: This Works
 
 
3. I also tried escaping my URL. But that does not work either. Modified my url to:
 
m1:f()
Status: That does not work. Got the same error message from Saxon as shown above.
 
Also note that I am using open source Saxon 851.
 
Any help will be appreciated.
Thank You.
premal
 
 


Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.