|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] FW: Unexpected token syntax error, unexpected DeclareFunction_Anil Shekhar anilshekhar at hotmail.comThu Oct 1 16:18:09 PDT 2009
Thanks Ken. It worked. I did learn something new today.
I am able to successfully read from a database. However if I add the argument to doc() to read files from the file system I do not see anything being displayed - blank page.
for $d in doc("file:///C:/Users/ashekhar/Desktop/Mark Logic/Shakespeare/*.xml")
Can you please help me understand?
Thanks
Anil
> Date: Wed, 30 Sep 2009 21:53:30 -0400
> To: http://x-query.com/mailman/listinfo/talk
> From: http://x-query.com/mailman/listinfo/talk
> Subject: Re: Unexpected token syntax error, unexpected DeclareFunction_
> CC:
>
> At 2009-09-30 18:13 -0700, Anil Shekhar wrote:
> >XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error,
> >unexpected DeclareFunction_
>
> The message says that your declaration of a function is unexpected.
>
> >in /shakespeare.xqy, on line 8 [1.0-ml]Line 8 is where I have
> >defined the function.
>
> Sure enough, that isn't an expected place for a function definition.
>
> Reviewing: http://www.w3.org/TR/xquery/#id-function-calls
>
> >3.1.5 Function Calls
> >[Definition: The built-in functions supported by XQuery are defined
> >in [XQuery 1.0 and XPath 2.0 Functions and Operators].] Additional
> >functions may be declared in a Prolog, imported from a library
> >module, or provided by the external environment as part of the static context.
>
> And that is pretty explicit that functions can only be declared in the prolog.
>
> You have:
>
> ><html>
> > <head>
> > <title>Shakespeare ...</title>
> > </head>
> > <body>
> > <p>
> > {
> > declare function local:handle-doc(
> > $doc as document-node(),
> > $speeches as element(SPEECH)+
> > )
>
> .... which doesn't have the declaration in the prolog, but in the
> middle of the query.
>
> So I think the error message is quite justified.
>
> I hope this helps.
>
> . . . . . . . . . . Ken
>
> --
> Upcoming hands-on code list, UBL, XSLT, XQuery and XSL-FO classes.
> Interested in other classes? http://www.CraneSoftwrights.com/q/i/
> Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/
> Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
> Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
> Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
> G. Ken Holman mailto:http://x-query.com/mailman/listinfo/talk
> Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc
> Legal business disclaimers: http://www.CraneSoftwrights.com/legal
>
> _______________________________________________
> http://x-query.com/mailman/listinfo/talk
> http://x-query.com/mailman/listinfo/talk
_________________________________________________________________
Insert movie times and more without leaving Hotmail®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20091001/eb054f0b/attachment.htm
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






