Changes

Jump to navigation Jump to search
96 bytes removed ,  18:31, 1 December 2023
m
Text replacement - "<syntaxhighlight lang="xquery">" to "<pre lang='xquery'>"
'''Main Module''' <code>hello-universe.xq</code>:
<syntaxhighlight pre lang="'xquery"'>
import module namespace m = 'http://basex.org/modules/hello' at 'hello-world.xqm';
m:hello("Universe")
'''Library Module''' <code>hello-world.xqm</code> (in the same directory):
<syntaxhighlight pre lang="'xquery"'>
module namespace m = 'http://basex.org/modules/Hello';
declare function m:hello($world) {
The following example calls a function from the FunctX module in the repository:
<syntaxhighlight pre lang="'xquery"'>
import module namespace functx = 'http://www.functx.com';
functx:capitalize-first('test')
Importing the repository module:
<syntaxhighlight pre lang="'xquery"'>
import module namespace m = 'http://basex.org/modules/Hello';
m:hello("Universe")
XQuery file <code>[https://files.basex.org/modules/org/basex/modules/Hello/HelloUniverse.xq HelloUniverse.xq]</code> (same as above):
<syntaxhighlight pre lang="'xquery"'>
import module namespace m = 'http://basex.org/modules/Hello';
m:hello("Universe")
; Main Module {{Code|hello-universe.xq}}:
<syntaxhighlight pre lang="'xquery"'>
import module namespace m = 'http://basex.org/modules/Hello';
m:hello("Universe")
; Wrapper Module {{Code|Hello.xqm}}:
<syntaxhighlight pre lang="'xquery"'>
module namespace hello = 'http://basex.org/modules/Hello';
We want to extend BaseX with this class and use its method. In order to make this possible we have to define an XQuery function which wraps the <code>print</code> method of our class. This can be done in the following way:
<syntaxhighlight pre lang="'xquery"'>
import module namespace j="http://basex.org/lib/testJar";
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu