Page 1 of 1

xdmp:unqote and cts:query($qNode/*) from the generated node

Posted: Wed Apr 26, 2017 1:11 pm
by vkdev
let $query:=<cts:path-range-query xmlns:cts="http://marklogic.com/cts" operator="&le;"><cts:path-expression>processInstance/tasks/task/auditTask/createdOn </cts:path-expression> <cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2017-04-25T23:59:59</cts:value> </cts:path-range-query>


This xml got generated when I serialized my xquery. I am having problem with the operator="&le;". when I do xdmp:unquote, and then do a let $colQuery as cts:query :=cts:query($qNode/*)

it gives error about invalid operation. since the expected string is "<=" and not ascii version of it.

how does one deal with doing xdmp:unquote of a string that has less than or greater than chars and the use the resulting node to create a cts:query?

Please any help would be greatly appreciated.

Re: xdmp:unqote and cts:query($qNode/*) from the generated node

Posted: Wed Apr 26, 2017 2:49 pm
by alex_jitianu
Hi,

If I understand it correctly, you have a query like this:

Code: Select all

let $query:=
   '<cts:path-range-query xmlns:cts="http://marklogic.com/cts" operator="&le;">
   <cts:path-expression>processInstance/tasks/task/auditTask/createdOn </cts:path-expression>
   <cts:value
        xsi:type="xs:dateTime"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2017-04-25T23:59:59</cts:value>
    </cts:path-range-query>'
   
    let $contents := xdmp:unquote($query, "", "repair-full")
   
    return cts:query($contents/*)


and you get an error like this:

Code: Select all

XDMP-ARG: cts:query(<cts:path-range-query operator="&#x2264;" xmlns:cts="http://marklogic.com/cts">...</cts:path-range-query>) -- op is invalid


I managed to reproduce this behavior myself but unfortunately I don't know how to fix it. I think a better place to ask this question is on the MarkLogic list (general@developer.marklogic.com) because the people there have more experience with MarkLogic. If you get an answer it might be good to post it here as well to help those that bump into it in the future.

Best regards,
Alex