[MarkLogic Dev General] module declaration boilerplate

Ron Hitchens ron.hitchens at marklogic.com
Mon Oct 20 17:00:37 PDT 2008


   To expand just a tiny bit on what Danny said.

   In MarkLogic Server 3.2, only one dialect of
XQuery is available.  It's based on the May 2003
Working Draft.  In 3.2, the syntax for declaring
the XQuery version is recognized (with no semi-colon),
but the actual value is ignored.  It's always the
May 2003 dialect, no matter what you declare.

   In Mark Logic Server 4.0, there are three dialects
available and the version value you provide must
match one of those three.  So even though you declared
that you wanted XQuery version "1.0", you still got
3.2's "0.9-ml" version which does not recognize the
newer module namespace declaration syntax.

On Oct 20, 2008, at 3:11 PM, Danny Sokolsky wrote:

> 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
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general

---
Ron Hitchens {ron.hitchens at marklogic.com}  650-655-2351






More information about the General mailing list