我有几个文件,xdmp:node-replace()某些元素不起作用.还有一些其他的文档几乎与那些有问题的文档类似,但xdmp:node-replace对它们完全正常.尝试了所有可能出错但却徒劳无功的可能性.阅读一些xdmp:node-replace函数在" 内存元素 "中不起作用的地方.
因此,为了验证问题是否与" 内存元素 "有关,我想知道究竟是什么.
对它有任何启发都会有很大的帮助
查询中构造的任何内容都是内存中的元素.例如,这个XQuery产生一个内存元素:
<test/>
Run Code Online (Sandbox Code Playgroud)
一些函数调用也返回内存中的元素:这xdmp:unquote是一个明显的例子.任何不是来自当前数据库的节点都将被视为内存节点.
此查询生成一个数据库元素(如果存在),可以使用xdmp:node-replace以下命令进行修改:
doc('fubar')/test
Run Code Online (Sandbox Code Playgroud)
这是典型的内存更新错误:
xdmp:node-replace(<x/>, <y/>)
Run Code Online (Sandbox Code Playgroud)
使用MarkLogic 6.0-1.1,错误代码是XDMP-UPCONSTNODES.
If you want to update in-memory nodes as if they were in the database by using similar function calls, there's a utility library that does that:
https://github.com/marklogic/commons/tree/master/memupdate
The main library also ships with MarkLogic Server under App Services:
appservices/utils/in-mem-update.xqy
| 归档时间: |
|
| 查看次数: |
833 次 |
| 最近记录: |