The XQuery Update Facility (XQUF) is an extension of XQuery. XQUF augments the capabilities of XQuery by allowing developers to not only query but also modify XML data directly within their XQuery code, making it a powerful tool for XML data manipulation and transformation.
XQuery Update Facility uses FLWOR expressions to make persistent changes to XML instance(s). These expressions update nodes using any or all of the following operations:
XMLSpy supports both XQuery Update 1.0 and 3.0. The XPath/XQuery Builder (shown above) makes it easy to compose and test the five types of update expressions with syntax coloring, code completion, and error message reporting.
The XPath/XQuery window provides numerous helpful tools for building and testing XQuery Update expressions, including:
You can preview the results of your update expressions as you type for easy troubleshooting, and clicking on a result in the preview window highlights the affected node in your instance document. Then, you can execute the updates with one click — either in the current file or across all open files, a folder, or an entire XMLSpy project.
According to the standard, that the result of an XQuery Update execution is a new XML file based on the original file and the specified modifications. This means that each execution completely reformats the document.
XMLSpy lets you skip this intermediary step, because it allows you to make updates directly in the specified XML file(s) without having to create a new file.
In this way, you’re armed with an intelligent mechanism for implementing XQuery Update via a familiar find-and-replace paradigm. However, because XQuery Update provides for sophisticated updates using the power of FLWOR statements, it overcomes the limitations of find-and-replace and lets you make complex, intelligent XML file modifications quickly and easily.
See how it works in the video below and try it for yourself with a free trial of XMLSpy.