XML Get Single Node

<< Click to Display Table of Contents >>

Navigation:  Actions > XML Documents >

XML Get Single Node

The action permits to extract a single node from the XML without using a cycle. You can specify a mask as a name of the node. If several nodes correspond to selected criteria, the action extracts the first node. The parameters of the action are like the parameters of XML Loop.

 

General parameters

 

GetXMLNode1

 

XML File

Read XML from file. This option is recommended if XML contain encoded strings. When the action reads it from file it decodes all encoded strings automatically.

The most popular UTF-8 encoding. XML file should have corresponding header. For example:

<?xml version="1.0" encoding="utf-8"?>

 

XML

Specify the XML text which you want to analyze. The text can be specified explicitly or with using of variables.

 

Node Path from Root

The Node Path is a criterion of selecting of loops from an XML document.

Specify a path of nodes from/of a root that you want to enumerate. It is possible to use mask symbols:

? -  means any single symbol.

* - means arbitrary number of symbols.

Examples of usage:

*\*\description

breakfast_menu\*\description

breakfast_menu\food\description

breakfast_menu\food\*

 

Order number

Enter the order number of node. Default is 0 (first node). XML file can contain nodes with the same names. Like records in database table. By default the action returns first matched element but you can specify another ordinal.

 

Save Node Text to variable

If you need to save a node text, switch on this checkbox and enter the variable name.

 

Raise an Error if Node is not Found

Switch on this checkbox if you want to raise an error. Otherwise the action put the warning message into the log.

 

Save TRUE (if found) or FALSE (not found) to variable

If you want to save search of necessary note to variable switch on this checkbox and input variable name below.

 

Save node parameters

The rest of node parameters are collected in this group of parameters.

 

GetXMLNode2

 

Save XML Node to Variable

To save the whole node, switch on this checkbox and enter the variable name.

 

Save Node Name to Variable

To save the node name, switch on this checkbox and enter the variable name.

The fact of the matter is that sometimes you cannot know a node name beforehand. For example, this is possible when you select nodes according a mask:

breakfast_menu\food\*

 

Save Node Path to Variable

To save the path of a node, switch on this checkbox and enter the variable name.

 

Save Node Depth to Variable

To save the depth of enclosure of the node, switch on this checkbox and enter the variable name. A node depth is a number, 0 corresponds to a root element.

 

Save Child Count to Variable

To save quantity of child nodes, switch on this checkbox and enter the variable name.

 

Save Node Attributes

 

GetXMLNode3

 

On this tab one can specify the attributes which values are necessary to be saved into variables. It is necessary to specify parameters for every attribute:

Name - The attribute name

Variable - The name of the variable in which it is necessary to save the attribute value.

Default value - The value which is written into a variable if the attribute is absent.

 

 

note Related Topics

XML Create Node

XML Add Childnode

XML Loop

XML Save