SET

LANSA Integrator

SET

The SET command is used to set the "current" node in the presently loaded XML document.  The "current" node is the node to which further queries (using the QUERY command) are applied.

When the document is loaded using the LOAD command, the current node is the document node.  It is not mandatory to issue the SET command to change the current node.  Providing the XPath expressions used in queries are formulated appropriately, they can be executed against the document node, and in many cases this will be all that is needed.

However, in more complex applications of the XMLQueryService, the SET command may be used, perhaps iteratively, to process specific sections of an XML document.  In particular, the generated XPath expressions returned by the QUERY command when the special *XPATH or *XPATH_CONCISE values are specified may be used with the SET command to iteratively process subsets of the document contents.

 

                                                         Required 

 

 SET -------- CURRENTNODE -------- xpath expression --------------|

                                  *DOCUMENT

 

 

Keywords

CURRENTNODE

The value of this keyword is used to set the current node in the loaded XML document as the node to which further queries (using the QUERY command) are applied.

The special value *DOCUMENT specifies that the document node is the current node – this is the default state immediately after loading an XML document with the LOAD command.

Alternatively you may specify an appropriately formulated XPath expression that identifies a single node in the document that is to be the "current" node.

For more information about XPath expressions used with the XMLQueryService, refer to Quick Guide to XPath expressions for use with XMLQueryService.

Examples

The following examples use the SET command to set the current node to the FIRST instance of an element anywhere in the document with the element name 'SalesOrder'.

RDML Example:

USE BUILTIN(JSM_COMMAND) WITH_ARGS('SET CURRENTNODE(//SalesOrder[1])') TO_GET(#JSMSTS #JSMMSG)

 

 

RDMLX Example:

use builtin(jsmx_command) with_args(#jsmhdle 'set currentnode(//SalesOrder[1])') to_get(#jsmsts #jsmmsg)

 

 

ILE RPG Example:

c                   eval      jsmcmd = 'set'                      

c                             + ' currentnode(//SalesOrder[1])'

c                   callp     p_jsmcmd(jsmcmd:jsmsts:jsmmsg)