[MarkLogic Dev General] module declaration boilerplate

Danny Sokolsky dsokolsky at marklogic.com
Mon Oct 20 15:11:30 PDT 2008


Hi Eric,

This is a difference between the May 2003 XQuery syntax and the XQuery
1.0 recommendation syntax.  MarkLogic Server 3.2 supports the May 2003,
and MarkLogic 4.0 supports the XQuery 1.0 recommendation (as well as the
May 2003 in with xquery version "0.9-ml" in the XQuery declaration).  So
if you are using 3.2 or 4.0 in compatibility mode, your module starts
like this:

xquery version "0.9-ml"
module "http://blah/session"
declare namespace session = "http://blah/session"

If you are using 4.0:

xquery version "1.0-ml";
module namespace session = "http://blah/session";

In 4.0, if your module starts with:

xquery version "1.0";

it indicates that the module is in strict mode.

For more details on the three XQuery dialects in 4.0, see the 4.0 XQuery
Reference Guide
(http://developer.marklogic.com/pubs/4.0/books/xquery.pdf).

Note that if your modules are in the 3.2 style (May 2003), they should
start with the following xquery declaration (*not* "1.0"):

xquery version "0.9-ml"

This will ensure that, when this code is run in 4.0, the module is
parsed using the May 2003 syntax.

-Danny


-----Original Message-----
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Eric
Palmitesta
Sent: Monday, October 20, 2008 2:49 PM
To: ML Developer Mailing List
Subject: [MarkLogic Dev General] module declaration boilerplate

All my modules start off with this boilerplate:

module "http://blah/session"
declare namespace session = "http://blah/session"

In the 2nd last page of the XQuery Style Guide 
http://xqdoc.org/xquery-style.pdf, I see this...

module namespace math = "http://xqdoc.org/sample-math-lib";

...which looks like it compresses two lines into one.  When I try this, 
I get "XDMP-UNEXPECTED: Unexpected token syntax error, unexpected 
QName_, expecting $end".

What am I missing?  Both their module and mine start with:

xquery version "1.0"

Cheers,

Eric
_______________________________________________
General mailing list
General at developer.marklogic.com
http://xqzone.com/mailman/listinfo/general


More information about the General mailing list