XMLGetElement (FB)

FUNCTION_BLOCK XMLGetElement

Reads a xml element from file. Use the function block XMLGetElementAsync for large XML files to get the values asynchronously. To read from file set sFileName to file path and paDataArray = 0. To read from data array set sFileName = ‘’ and paDataArray to data pointer.

InOut:

Scope

Name

Type

Initial

Comment

Input

sFileName

STRING(255)

Path to a file

udiStartPosition

UDINT

Start position in file to read elements. Use XMLElement.udiPosition´

readMode

READ_MODE

Read mode

paElements

POINTER TO XMLElement

Pointer to the result set

udiMaxElements

UDINT

Maximum size of paElements

xTruncateValues

BOOL

FALSE

true: All values that exceed the maximum value size will be truncated

paDataArray

POINTER TO BYTE

0

Pointer to XML data array, if 0 read from file (sFileName)

udiDataArraySize

UDINT

0

Size of paDataArray

Output

eError

ERROR

Error

udiCountElements

UDINT

Number of elemnents in paElements#

udiNextReadPos

UDINT

Position in file (in bytes) of the next xml element, 0 if last element

eEncoding

Encoding

Encoding of the xml file