XQuery Update Facility

The XQuery 1.0 language provides expressions for querying input documents and adding to the results. However, it does not have any specific expressions for inserting, updating, or deleting XML data. As we saw in Chapter 9, it is possible to modify input elements and attributes using user-defined functions, but this is somewhat cumbersome. In addition, this only transforms input documents to be returned as the query results; it offers no ability to specify that XML data should be permanently changed in a database.

To address this need, the W3C XQuery Working Group is working on an XQuery Update Facility that will provide specialized operators and/or built-in functions for updates. At the time of this writing, only a draft requirements document has been publicly released. It specifies that the XQuery Update Facility will have functionality that allows for:

  • Deleting nodes

  • Inserting nodes in specified positions

  • Replacing nodes

  • Moving nodes

  • Changing the typed value of nodes

  • Modifying properties of a node, such as name, type, content, base URI, etc.

For more information on the XQuery Update Facility requirements, see http://www.w3.org/TR/xquery-update-requirements.

Get XQuery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.