XQuery/Update Execution

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  User Guide and Reference > XQuery >

XQuery/Update Execution

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 Source for the XQuery dialog (screenshot below).

ic_xquery_transform

XQuery/ Update Execution toolbar icon

XQDefineXMLSource

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

 

Typically, an XQuery document is not associated with any single XML document. This is because XQuery expressions can select any number of XML documents with the doc() function. In XMLSpy, however, before executing individual XQuery documents you can select a source XML document for the execution. In such cases, the document node of the selected XML source is the starting context item available at the root level of the XQuery document. Paths that begin with a leading slash are resolved with this document node as its context item.

 

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).

ic_xquery_transform

XQuery/ Update Execution toolbar icon

XQSelectXQU

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

 

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).

 

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.

 


© 2019 Altova GmbH