Mike,
Sorry, I should have added that I might want to use options with
xdmp:eval. E.g.
my:doc-perms-set($URI, $perms, $DB) {
let $query := ...
let $args := ...
let $options := <options xmlns="xdmp:eval">
<database>{xdmp:database($DB)}</database>
</options>
return xdmp:eval($URI, $perms, $options)
};
Tim
On 04/24/2013 01:13 PM, Michael Blakeley wrote:
> Why call eval?
>
> -- Mike
>
> On Apr 23, 2013, at 21:41, Tim Finney <[email protected]> wrote:
>
>> Hi Everyone,
>>
>> Say I have an amped function to set doc permissions. E.g.
>>
>> declare function my:document-set-permissions(
>> $URI as xs:string,
>> $permissions as element()*
>> ) as empty-sequence() {
>> try {
>> let $query := '
>> declare variable $URI external;
>> declare variable $permissions external;
>> xdmp:document-set-permissions($URI, $permissions)
>> '
>> let $args := (
>> fn:QName("", "URI"), $URI,
>> fn:QName("", "permissions"), $permissions
>> )
>> return xdmp:eval($query, $args)
>> }
>> catch ($e) { fn:error(xs:QName("e:fail"), "operation failed", $e) }
>> };
>>
>> I call this like so:
>>
>> let $URI := "myURI"
>> let $permissions := (
>> xdmp:permission("app-user", "read"),
>> xdmp:permission("app-user", "update")
>> )
>> return my:document-set-permissions($URI, $permissions)
>>
>> However, I get this error which is caused by fn:data which is presumably
>> called by xdmp:eval.
>>
>> XDMP-NONMIXEDCOMPLEXCONT 1.0-ml Node has complex type with non-mixed
>> complex content XDMP-NONMIXEDCOMPLEXCONT: fn:data(<sec:permission
>> xmlns:sec="http://marklogic.com/xdmp/security"><sec:capability>update</sec:capability><sec:role-id>...</sec:permission>)
>>
>>
>> Is there a way to pass in the permissions elements?
>>
>> Best,
>>
>> Tim Finney
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
>>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general