Im trying to export the data within my MarkLogic database into CSV format using CoRB.
and the Process Query has been giving out XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected QName_, expecting Exteral_ or ColonEquals_ or Lbrace_
My XML data (customer1~10.xml)
<?xml version="1.0" encoding="UTF-8"?>
<customer>
<name>Customer1</name>
<address>123 Main St</address>
<company>A Corporation</company>
<emailAddress>[email protected]</emailAddress>
</customer>
My Uri query
xquery version "1.0-ml";
let $dir := "/"
let $listDoc := cts:uris((), (), cts:directory-query($dir, "infinity"))
let $count := fn:count($listDoc)
let $URI := ($count, $listDoc)
return $listDoc
My Process query
xquery version "1.0-ml";
declare variable $URI xs:string external;
let $elementNames := ("name", "address", "company", "emailAddress")
let $doc := cts:search(/*, cts:document-query($URI))
let $textOutput :=
for $i in $elementNames
return $doc/*[fn:name() = $i]/text()
return fn:string-join($textOutput, ",")
You are missing
aswhen asserting the type of the$URIvariable:You can test and troubleshoot your modules in Query Console. For syntax errors such as this, if you tried to execute it would give you an error message and point to where the problem is:
Also, if you wanted to test your process module, you can assign a single value to the
$URIto process: