Altova XMLSpy 2024 Enterprise Edition

Previewing and Applying Updates

Home Prev Top Next

If you wish to modify an XML document using XQuery Update, you can preview updates before applying them to the XML document and saving the modified document.

 

In the XPath/XQuery output window (screenshot below), you can enter one or more update expressions and then preview updates in the pending update list (PUL) that is displayed in the bottom pane (see screenshot below). If the PUL is as you want it, you can apply the updates to the document and then save the modified document. If you wish not to go ahead with the modifications in the PUL, you can choose either to not apply modifications or to not save the file.

XQUpdatePUL01

To create a PUL for an active XML file, do the following:

 

1.In the toolbar of the XPath/XQuery output window (screenshot above), select either the XQU 1.0 or XQU 3.0 icon (respectively for XQuery Update 1.0 or XQuery Update 3.0).

2.Enter one or more update expressions in the top pane of the window. For a description of update expressions and their syntax, see the section, Update Operations and Syntax.

3.In the toolbar's Where combo box, select the location to be scanned for the updates:
Current file: Only the currently active file is scanned. If the location selected for scanning is Current file, then the Evaluate XPath/XQuery Expression on Typing toolbar icon is enabled
Open files: All files that are currently open in XMLSpy will be scanned
Project: The currently active project is scanned
Folder: You can select a folder to scan

4.To execute the update expression/s and display the PUL, click the Evaluate XPath/XQuery Expression toolbar icon.

 

XPath/XQuery output window toolbar

The toolbar commands of the XPath/XQuery output window (screenshot below) are described in the table below.

XQUpdateXPXQWinTbar
icStartEvalDebug

Start Evaluation/Debugging (F5)

Enables selection of Evaluation Mode, and starts the evaluation

icStopDebugger

Stop Evaluation/Debugging (Shift+F5)

Enabled during evaluation. It is useful if the evaluation takes very long or goes into an endless loop, and you therefore want to stop the evaluation

icValidateXML

Validate XML

When toggled on, the target XML document/s are validated

XPWinCreateXPFromSelLoc

Copy XPath of Current Selection

Copies the locator path of the node in the XML document to the last cursor position in the Expression pane

ic_xpath_relative

Set current selection as context

Toggles expression context between root node and the current selection

icLoadSnippet

Load Snippet

Loads an XPath/XQuery snippet from an XQuery file to the evaluator pane, overwriting the current contents of teh pane

icSaveSnippet

Save Snippet

Saves an XPath/XQuery snippet from the evaluator pane to an XQuery file

ic_XMLJSONEvalMode

XML/JSON Evaluation Mode (toggles between XML and JSON evaluation modes)

The highlighted icon of the pair is the active option. When evaluation scope is multiple files, both icons are enabled and one can be selected. Otherwise, evaluation mode is auto-detected according to file type; the other icon is disabled.

icSwitchToExpBuilder

Switch to Builder

Switches to Expression Builder mode, which provides context-sensitive entry helpers to help construct expressions

ic_xpath_dynamiceval

Evaluation on typing

Switches on the evaluation of expressions while the expression is being typed

icShowOptionsDebugWin

Show Options

Opens an Options dialog for setting the display options of results

icHorizontalVerticalLayout icHorizontalLayout

Horizontal/Vertical Layout

Switches between horizontal and vertical layouts

 

The Pending Update List (PUL) pane

The PUL pane shows all the updates that will be carried out. If the Show Header option has been toggled on in the window's toolbar, the locations of target files are displayed. The PUL display is divided into three vertical sections (see screenshot below): (i) the update action to carry out; (ii) the content of the target node to be updated; (iii) the update action result.

XQUpdatePULTbar

The following PUL pane toolbar commands are available:

 

The Next and Previous icons select, respectively, the next and previous messages to the currently selected message.

The Copy Selected Line and Copy All Messages commands copy, respectively, the selected line and all messages to the clipboard.

The Copy Includes All Columns command is a toggle command that switches on/off the copying of all columns.

The Find commands find text in the PUL pane.

The Expand with Children command expands the selected node and all its descendants.

The Collapse with Children command collapses the selected node and, within it, all its descendants.

The Clear command deletes all lines in the PUL pane.

The Apply Update(s) command applies the pending updates to the target locations. On updating, the updates can be saved to file, or the updated file can be displayed (and subsequently saved manually or not). See the next option.

The Open Files on Updating combo box allows you to select (i) whether updated files are opened and made active in XMLSpy, or (ii) whether files are updated silently on disk. If the former option is selected, then non-open or non-active target files are opened and/or are made active. You then have the choice of saving the modified document or not.

 

Note:If one or more files have been updated directly on disk, a list of changed files is displayed. each item in the list shows the location of the file and is a clickable link to the file.

 

© 2017-2023 Altova GmbH