[XQZone General] Problem in Setting Xquery Variable Values

McBeath, Darin W (ELS-AMS) D.McBeath at elsevier.com
Tue Dec 13 07:01:01 PST 2005


You need to keep in mind which version of the XQuery specification is
supported by MarkLogic.  It currently supports the May 2003 XQuery Working
Draft.  The second syntax you mention below is from a more recent working
draft (and hence will not work with MarkLogic).

Darin.

-----Original Message-----
From: general-bounces at xqzone.marklogic.com
[mailto:general-bounces at xqzone.marklogic.com] On Behalf Of Sandesh Pai
Sent: Tuesday, December 13, 2005 9:35 AM
To: General XQZone Discussion
Subject: Re: [XQZone General] Problem in Setting Xquery Variable Values

Hi and thanks for the quick reply,
  As Ron said " define variable $foo as xs:string external " works but
I was thinking
  "declare variable $foo external; " should work.
 Can you tell me what is the diffrence between these two and why the
second one is not working?

Regards
Sandesh

On 12/10/05, Ron Hitchens <ron.hitchens at marklogic.com> wrote:
>
> Sandesh,
>
>     Yeah, it's hard to tell for sure what the problem is
> without seeing the exact code.
>
>     You can get tripped up by namespaces as Jason suggests.
> You also need to make sure you declare external variables
> in your XQuery script, like this:
>
>       define variable $foo as xs:string external
>
>     If the XQuery code that you're fetching at runtime
> does not have declarations for the variables you're setting
> on the XDBCStatement object, then the server will not be
> able to setup the bindings when the XQuery request is
> evaluated.
>
> On Dec 9, 2005, at 9:16 AM, Jason Hunter wrote:
>
> > Hi Sandesh,
> >
> > It would help if you included the query and names.  My blind guess
> > is that your variable is in a namespace, and you're not taking that
> > into account when assigning it by name.  Namespaces are an
> > intrinsic part of names.
> >
> > -jh-
> >
> > Sandesh Pai wrote:
> >
> >> Hi,
> >>    I am using XDBC api's in our application.
> >>    I have a xquery file which I read at runtime and get the
> >> content as string.
> >>    and I do the follwing part
> >>   xdbcStatement = connection.createStatement();
> >>   XDBCXName varName = new XDBCXName(name1);
> >>   xdbcStatement.setString(varName,variableValue1);
> >>                       varName = new XDBCXName(name2);
> >>   xdbcStatement.setInteger(varName,variableValue2);
> >>  XDBCResultSequence xdbcResult = xdbcStatement.executeQuery(query);
> >> But I get the exception saying
> >> Undefined variable name1
> >> I dont know what is the problem..please help me on this
> >> Regards
> >> meetpai at gmail.com
> >> _______________________________________________
> >> General mailing list
> >> General at xqzone.marklogic.com
> >> http://xqzone.com/mailman/listinfo/general
> > _______________________________________________
> > General mailing list
> > General at xqzone.marklogic.com
> > http://xqzone.com/mailman/listinfo/general
>
> ---
> Ron Hitchens {ron.hitchens at marklogic.com}  650-655-2351
>
>
> _______________________________________________
> General mailing list
> General at xqzone.marklogic.com
> http://xqzone.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
General at xqzone.marklogic.com
http://xqzone.com/mailman/listinfo/general



More information about the General mailing list