xdmp:document-insert --error

Issues related to W3C XQuery.
vkdev
Posts: 21
Joined: Sat Jan 07, 2017 12:54 am

xdmp:document-insert --error

Post by vkdev » Mon Jan 30, 2017 11:14 pm

Consider this simple script that I try to run in oxygen. Its connected to Marklogic server.

let $a1:=xdmp:unquote("<a><b>bbb</b></a>")
xdmp:document-insert("/vk/test/example.xml",$a1
)
In oxygen editor it gives error- XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected QName_

Same script runs fine in marklogic query console.

alex_jitianu
Posts: 682
Joined: Wed Nov 16, 2005 11:11 am

Re: xdmp:document-insert --error

Post by alex_jitianu » Tue Jan 31, 2017 4:14 pm

Hi,

The different behavior might be explained if Oxygen and Marklogic's query console use AppServers that have different default xquery version. For an Xquery 1.0 the query should be:

Code: Select all

let $a1 := xdmp:unquote("<a><b>bbb</b></a>")
return xdmp:document-insert("/vk/test/example.xml",$a1)
If needed, you can force the query version of the query:

Code: Select all

xquery version "0.9-ml"; 
let $a1 := xdmp:unquote("<a><b>bbb</b></a>")
xdmp:document-insert("/vk/test/example.xml",$a1)
Best regards,
Alex

Post Reply