XMLPATH

Concept Link IconSee also Concept Link IconExample

Process Xml formatted data according to XPath (Xml Path Language) specifications.

WebVue support - Yes.

Mode

Mnemonic

Syntax

1 GET 1
2 GETSTR 2
3 GETDOUBLE 3
4 GETSINGLE 4
5 GETLONG 5
6 GETINT 6
7 GETBOOL 7
8 LOAD 8
9 UNLOAD 9
10 LOADFILE 10
12 COUNT 6

Format of the Namespace when using XMLPATH with either the Alarm or Log viewer

The format of the namespace is as follows. Note that the string is case sensitive.

Branch/Mimic/ViewerId

Argument

Meaning

Branch

The branch with which the mimic is opened. If the mimic is not opened with a branch a null string should be used.

Mimic

The mimic file name.

ViewerID

The alarm or log viewer ID that can be found or changed using the Graphic Explorer.

Arguments common to more than one mode

Argument

Meaning

Namespace

The identifier of the Xml fragment used as input. Type STR or LONG.

XmlPath

Hierarchical path. Type STR or LONG.

Syntax 1

LongVal = XMLPATH(Mode, Namespace, XmlPath);

Return type: LONG.

Execution

Mode

Mnemonic

Action

1

GET

Returns a handle for the XmlPath path in Namespace.

LongVal is automatically allocated and reallocated if the verb is called cyclically. There is no need to do any allocation via ALLOC_BUFFER. There is no limit in buffer size, so we recommend the project designer to be careful when handling large Xml fragments as it can require a large amount of memory.

The LongVal handle is finally de-allocated when the UNLOAD mode is called.

Syntax 2

StrVal = XMLPATH(Mode, Namespace, XmlPath);

Return type: STR.

Execution

Mode

Mnemonic

Action

2

GETSTR

Returns the string value corresponding to the XmlPath path from the Namespace.

Syntax 3

DoubleVal = XMLPATH(Mode, Namespace, XmlPath);

Return type: DOUBLE.

Execution

Mode

Mnemonic

Action

3

GETDOUBLE

Returns the double value corresponding to the XmlPath path from the Namespace.

Syntax 4

SingleVal = XMLPATH(Mode,Namespace, XmlPpath);

Return type: SINGLE.

Execution

Mode

Mnemonic

Action

4

GETSINGLE

Returns the single value corresponding to the XmlPath path from the Namespace.

Syntax 5

LongVal = XMLPATH(Mode, Namespace, XmlPath);

Return type: LONG.

Execution

Mode

Mnemonic

Action

5

GETLONG

Returns the long value corresponding to the XmlPath path from the Namespace.

Syntax 6

IntVal = XMLPATH(Mode, Namespace, XmlPath);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

6

GETINT

Returns the integer value corresponding to the XmlPath path from the Namespace.
12 COUNT Returns the number of instances of the element specified by the XmlPath path.

Syntax 7

IntVal = XMLPATH(Mode, Namespace, XmlPath);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

7

GETBOOL

Returns the boolean value (as an integer) corresponding to the XmlPath path from the Namespace.

  • 1 for <true>
  • 0 for <false>

Syntax 8

IntVal = XMLPATH(Mode, Namespace, XmlData);

Return type: INTEGER.

Argument

Meaning

XmlData

Content of the Xml file. Type STR or LONG.

Execution

Mode

Mnemonic

Action

8

LOAD

Load and map the Xml fragment into the context identified by Namespace.

Return: 1 if successful, -1 if an Xml parsing error occurred.

Syntax 9

IntVal = XMLPATH(Mode, Namespace);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

9

UNLOAD

Unload and unmap the Xml fragment in the context identified by Namespace.

Return: Always 0.

UNLOAD must be used once XML operations are complete to release any memory allocated by either modes LOAD or LOADFILE.

Syntax 10

IntVal = XMLPATH(Mode, Namespace, XmlFilename);

Return type: INTEGER.

Argument

Meaning

XmlFilename The name of the Xml file to load. Type STR or LONG.

Execution

Mode

Mnemonic

Action

10

LOADFILE

Load and map an Xml fragment from a file.

Return: 1 if successful, -1 if an Xml parsing error occurred, -2 if file not found.

If executed in a WebVue session context this instruction is processed by the computer that hosts the web back end and the referenced file is on that computer.

Example

For an example, select the Examples link above.