Hello,
I feel very stupid and frustrated, not able to fix this error:
Below, is a my query code, which I am trying to run. I am passing the value for "contains" clause thru command line and I expect to receive # of xml files matching $cmd xpath. I always get
Stopped at /veracode/msheth/BaseXWeb/get_prevalence.xq, 16/12:
[XPST0003] Expecting ':=', found ':'.
When ran thru REST:
[XPST0003] Expecting valid step, found 'd'.
I think, its the way $cmd is being set. I have tried, simple string concat using ||, using concat command, using html entities etc.
declare variable $n as xs:string external;
declare option output:item-separator "
";
(: let $cmd := concat("/A/*/descendant::C/descandant::*[contains(@name,",$singlequote,$n,$singlequote,")]") :)
let $cmd := "/A/*/descendant::C/descandant::*[contains(@name,'"|| $n ||"')]"
let $aPath :=
for $db in db:list()
let $query :=
"declare variable $db external; " ||
"db:open($db)" || $cmd
return xquery:eval($query,
map { 'db': $db, 'query': $cmd })
let $clients :=
for $elem in $aPath
return db:path($elem)
return $n , distinct-values(count($clients))
Lines of code, which are the culprit, are marked in bold above. Any and all suggestions are greatly appreciated.