PatchBuilderPlan.prototype.insertBefore( path as String, content as Node ) as PatchBuilderPlan
Insert a new node before another node.
Parameters | |
---|---|
path | The path to insert the node before. |
content | The node to insert. |
'use strict'; declareUpdate(); const op = require('/MarkLogic/optic'); const docDescriptors = [{uri: '/optic/update/write4.xml',doc:xdmp.unquote("<doc><action>write4</action></doc>")}, {uri: '/optic/update/write5.xml',doc:xdmp.unquote("<doc><action>write4</action></doc>")}] op.fromDocDescriptors(docDescriptors) .patch(op.col('doc'), op.patchBuilder('/doc') .insertBefore("action",xdmp.unquote("<status>NEW</status>")) ) .write() .result();
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.