Re: [basex-talk] XPTY0004 error when calling http:send-request inside of a local function

2020-10-11 Thread Bridger Dyson-Smith
Christian, As always, thank you for your help! I had tried the following ```xquery declare function local:grab2( $url as xs:string, $path as xs:string, $fname as xs:string ) as document-node() { let $req := http:send-request(, $url) return if (head($req)/@status = "200") then fi

Re: [basex-talk] XPTY0004 error when calling http:send-request inside of a local function

2020-10-11 Thread Christian Grün
Hi Bridger, As your query will either return an empty sequence (in the case of success) or a string (in the case of an error), you’ll need to use xs:string? as return type: declare function local:grab( $url as xs:string, $path as xs:string, $fname as xs:string ) as xs:string? { ... Hope

Re: [basex-talk] XPTY0004 error when calling http:send-request inside of a local function

2020-10-11 Thread Bridger Dyson-Smith
And naturally I forgot to mention... On Sun, Oct 11, 2020 at 3:49 PM Bridger Dyson-Smith wrote: > Hi all - > > I'm accustomed to writing something like the following: > > ```xquery > > declare function local:grab( > $url as xs:string, > $path as xs:string, > $fname as xs:string > ) as docum

[basex-talk] XPTY0004 error when calling http:send-request inside of a local function

2020-10-11 Thread Bridger Dyson-Smith
Hi all - I'm accustomed to writing something like the following: ```xquery declare function local:grab( $url as xs:string, $path as xs:string, $fname as xs:string ) as document-node() { let $req := http:send-request(, $url) return if (head($req)/@status = "200") then file:write