|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
util:import-module?Hi all
I was looking for possibilities to be more dynamic in the way modules are loaded, and was happy to see that there was the util:import-module function for this. I am however unsuccessful in my attempts to run something basic (under version 1.2.0): (:Try to dynamicaly load modules:) let $a:=util:import-module ( "http://www.e-smile.org/header" ,"header", "modules/header.xqm") returns the error: Error checking function parameter 1 in call util:import-module(untyped-value-check[xs:anyURI, "http://www.e-smile.org/header"], "header", untyped-value-check[xs:anyURI, "modules/header.xqm"]): FORG0001: xs:string(http://www.e-smile.org/header) is not a sub-type of xs:anyURI [at line 89, column 9] As I new to eXist, there might be something stupid I am missing... Is there somebody who uses this function with success? Best regards Christophe |
|
|
Re: util:import-module?Afraid so,
The hint is in the error message - xs:string is not a sub-type of xs:anyURI - the function expects URI's for parameters 1 and 3 as stated in the function documentation. Try this instead - et $a:=util:import-module (xs:anyURI("http://www.e-smile.org/header") ,"header", xs:anyURI("modules/header.xqm")) 2008/7/3 geiser ch. <christophe.geiser@...>: > > Hi all > I was looking for possibilities to be more dynamic in the way modules are > loaded, and was happy to see that there was the util:import-module function > for this. > I am however unsuccessful in my attempts to run something basic (under > version 1.2.0): > > (:Try to dynamicaly load modules:) > let $a:=util:import-module ( "http://www.e-smile.org/header" ,"header", > "modules/header.xqm") > > returns the error: > Error checking function parameter 1 in call > util:import-module(untyped-value-check[xs:anyURI, > "http://www.e-smile.org/header"], "header", untyped-value-check[xs:anyURI, > "modules/header.xqm"]): FORG0001: xs:string(http://www.e-smile.org/header) > is not a sub-type of xs:anyURI [at line 89, column 9] > > As I new to eXist, there might be something stupid I am missing... > Is there somebody who uses this function with success? > > Best regards > Christophe > > -- > View this message in context: http://www.nabble.com/util%3Aimport-module--tp18256003p18256003.html > Sent from the exist-open mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Exist-open mailing list > Exist-open@... > https://lists.sourceforge.net/lists/listinfo/exist-open > -- Adam Retter eXist Developer { England } adam@... irc://irc.freenode.net/existdb ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Exist-open mailing list Exist-open@... https://lists.sourceforge.net/lists/listinfo/exist-open |
|
|
Re: util:import-module?Thank you Adam
Promise, I'll try to be better as fast as I can... I am however still kind of stuck with this: I can't dynamically associate the prefix with the namespace. In more detail: I have one function that load the module in the prologue. It looks like: declare function index:load-module() { util:import-module (xs:anyURI("http://www.e-Smile.org/header") ,"header", xs:anyURI("modules/header.xqm")) }; In the body, there is a call to this function followed by a call to another function in the header.xqm module: {index:load-module()} {header:info-header()} that return the error: "XPST0081: No namespace defined for prefix header" Now, the function util:import-module seem to work. Or at least, it cries when I refer to a module that does not exist or have different namespace in the .xqm file and the first parameter. I tried a lot of variants of this, again without success (have the header:info-header() in the index:load-module() function, load the module in the prologue without a function, insert the "util:import-module ..." statement in the body,...) One strange thing though is that if I have an error in my index:load-module() function (e.g. refer to a .xqm file that does not exist), the error returned by the xquery is the same XPST0081: No namspace.... To make the problem with the index:load-module() appear (e.g. source for module modules/headerww.xqm not found in database), I first need to remove the line {header:info-header()} from the body Sorry again if this is something stupid simple ... Best regard Christophe
|
| Free Forum Powered by Nabble | Forum Help |