XMLWrite (FB)

FUNCTION_BLOCK XMLWrite

Writes a xml file. Use the function block XMLWriteAsync for large XML files to write the values asynchronously. To write to file set sFileName to file path and paDataArray = 0. To write to data array set sFileName = ‘’ and paDataArray to data pointer.

InOut:

Scope

Name

Type

Initial

Comment

Input

sFileName

STRING(255)

Path to a file

paElements

POINTER TO XMLElement

Pointer to the result set

udiCountElements

UDINT

Number elements in paElements

eEncoding

Encoding

File encoding

paDataArray

POINTER TO BYTE

0

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

udiDataArraySize

UDINT

0

Size of paDataArray

xAddDeclaration

BOOL

TRUE

Adds XML declaration with encoding info like ‘<?xml version=”1.0” encoding=..’, default: TRUE

Output

eError

ERROR

Error