Loading TOC...

xdmp:node-delete

xdmp:node-delete(
   $old as node()
) as empty-sequence()

Summary

Deletes a node from the database. On-the-fly constructed nodes cannot be deleted.

Parameters
$old The node to be deleted.

Example

xdmp:document-insert("/example.xml",
    <a><b>bbb</b></a>);
xdmp:node-delete(doc("/example.xml")/a/b);
doc("/example.xml")
=>
 <a/>

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • This returns an empty sequence even when the node to be deleted does not exist.
  • /Modules/MarkLogic/appservices/utils/in-mem-update.xqy library module contains five functions that are analogous to the xdmp:node-* functions, but act on in-memory XML nodes instead of in-database documents. For easy reference, the five are: mem:node-insert-child() mem:node-insert-before() mem:node-insert-after() mem:node-replace() mem:node-delete() Further details please refer, http://developer.marklogic.com/blog/xquery-recursive-descent