Search code examples
xmlxsltxpathxquery

Does XQuery (or XPath) have equivalents to Update, Insert, and Delete as well as Select?


I know how to find what I need from XML using XPath. The syntax takes a little getting used to, but it is quite powerful. I'm interested in learning XQuery also, but the SQL like syntax seems awkward. Even so, if it can provide not just a select equivalent, but also update, insert, and delete as SQL does, I will forgive all awkwardness.

So, does XQuery have equivalents to Update, Insert, and Delete as well as Select?

Does XPath have these equivalents that I have overlooked?


Solution

  • No. None of XPath or XQuery has SQL-like update/insert/delete functionality.

    You need to look for an implementation of the "XQuery 1.0 Update Facility".

    At this moment (Nov. 2008), three such are known:

    1. SaxonSA XSLT and XQuery Processor — by Michael Kay; Supported since version 9.1, but only in the commercial version.
    2. MonetDB/XQuery - An open source XQuery processor on top of the MonetDB relational database system.
    3. XQilla - An open source (ASL2.0) XQuery processing library with support for the latest XQuery Update features. XQilla is written in C++ and includes a command line executable shell to execute queries against XML content stored on a local filesystem. This library is actively developed and part of a supported Oracle product, Berkeley DB XML.