Altova XMLSpy 2024 Enterprise Edition

XQuery/Update Execution

Home Prev Top Next

An XQuery or XQuery Update document can be run in the following ways:

 

When the XQuery or XQuery Update document is active.

When an XML document is active.

 

Note:Whether a document is an XQuery document or XQuery Update document is determined by the document's file extension. XMLSpy recognizes file type associations according to the definitions made in Filetypes section of the Options dialog. (Tools | Options | Filetypes).

 

Note:For XQuery Update, you can also enter Update expressions in the XPath/XQuery output window and preview updates. If the updates are acceptable, you can apply the updates and then save the updated file. See XQuery Update Facility and Previewing and Applying Updates for more details.

 

Execution with XQuery or XQuery Update document active

To execute an XQuery or XQuery Update document with the XQuery / XQuery Update document active, do the following

 

1.Make the XQuery or XQuery Update document the active document.

2.Select XSL/XQuery | XQuery/ Update Execution or click the command's toolbar icon. This opens the Define an XML or JSON Input for the XQuery dialog (screenshot below).

XQDefineXMLSource

3.Either browse for an XML/JSON file and execute, or skip the selection of an XML source.

 

ic_xquery_transform

XQuery/ Update Execution toolbar icon

 

Typically, an XQuery document is not associated with a specific XML/JSON document. (However, an association might be made with the XQuery doc() function.) In XMLSpy, before executing individual XQuery documents you can select a source XML/JSON document for the execution. In such cases, the document node of the selected source is the starting context item of the XQuery document.

 

Note:The XQuery/ Update Execution command is also available in the context menu of Project Window items.

 

Result of execution / update

XQuery execution: The result document is generated as a temporary file that can be saved to any location with the desired file format and extension.

XQuery update: The update is saved to file, or the updated file is opened, allowing you to preview it, and then either save or close without saving. You can specify which of the two actions to carry out. This is done in the the XQuery section of the Options dialog (Tools | Options | XQuery).

 

Execution with XML document active

To execute an XQuery or XQuery Update document on an active XML document, do the following

 

1.Make the XML document the active document.

2.Select XSL/XQuery | XQuery/ Update Execution or click the command's toolbar icon. This opens the Choose XQuery/Update File dialog (screenshot below).

XQSelectXQU

3.Browse for the XQuery or XQuery Update file and click OK.

 

ic_xquery_transform

XQuery/ Update Execution toolbar icon

 

Result of execution / update

XQuery execution: The result document is generated as a temporary file that can be saved to any location with the desired file format and extension.

XQuery update: The update is saved to file, or the updated file is opened, allowing you to preview it, and then either save or close without saving. You can specify which of the two actions to carry out. This is done in the the XQuery section of the Options dialog (Tools | Options | XQuery).

 

Back-mapping

With the Back-mapping feature enabled, XQuery execution will be carried out so that the result document can be mapped back on to the originating XQuery+XML documents. If you click on a node in the result document, then the XQuery instruction and the XML source data that generated that particular result fragment will be highlighted. Additionally, if you click on an XQuery instruction or an XML data node, then the corresponding nodes in the other two documents are highlighted. See the XSL/XQuery | Enable Back-Mapping command for details.

 

XQuery Variables

If you are using the Altova XQuery engines, XQuery variables can be stored in a convenient GUI dialog. All the stored variables are passed to the XQuery document each time you execute an XQuery document via XMLSpy. For more information, see the description of the XSLT Parameters / XQuery Variable command.

 

Altova XQuery Engines

For details about how the Altova XQuery Engines are implemented and will process XQuery files, see XQuery Engine Implementation.

 

© 2017-2023 Altova GmbH