ERROR (ENUM) ¶ TYPE ERROR : Error codes of the XML Utility Attributes: qualified_only InOut: Name Initial Comment NO_ERROR 0 Executed without error TIME_OUT 1 Time out FILE_OPEN_ERROR 2 Could not open file INVALID_HANDLE 3 Open file retuned invalid handle READ_ERROR 4 Could not read file WRITE_ERROR 5 Could not write file SET_POS_FAILED 6 Invalid file position NOT_FOUND 7 Element not found START_TAG_NOT_FOUND 8 Start tag of the element not found NEXT_START_TAG_NOT_FOUND 9 Next start element not found. ELEMENT_EXCEEDS_BUFFERSIZE 10 Element size exceeds buffer size. Increment the value of gc_udiBufferSize . COMMENT_EXCEEDS_BUFFERSIZE 11 Comment size exceeds buffer size. Increment the value of gc_udiBufferSize . BLANK_NOT_FOUND 12 Missing blank between attributes MAX_ELEMENT_SIZE_EXCEEDED 13 Maximum array size of XMLElemnts exceeded DATA_ARRAY_POINTER_IS_NULL 14 Data pointer is null EMPTY_DATASET 15 Empty dataset MAX_VALUE_SIZE_EXCEEDED 16 Maximum value size exceeded. Increment the value of gc_udiMaxValueSize . INVALID_LICENSE 17 No valid license found or demo mode has expired. INVALID_INPUT_MAXELEMENTS 18 No valid udiMaxElements, e.g. udiMaxElements = 0
ElementType (ENUM) ¶ TYPE ElementType : Type of the xml element InOut: Name Initial Comment Element 0 Marks an element CDATAElement 1 Marks an element with CDATA Attribute 2 Marks an attribute of an element Comment 3 Marks an comment NotSet 4 Marks an empty element
Encoding (ENUM) ¶ TYPE Encoding : Encoding of a xml file InOut: Name Initial Comment UTF8 0 UFT-8 encoding UTF16 1 UTF-16 encoding
READ_MODE (ENUM) ¶ TYPE READ_MODE : Read modes InOut: Name Initial Comment ONE_ELEMENT 0 Reads only the specified element CHILDREN_ONLY 1 Reads all child elements of the specified element RECURSIVE 2 Reads all underlying elements of the specified element
Function Blocks ¶ Function blocks to read, write and find XML elements. XMLFindElement (FunctionBlock) XMLFindElementAsync (FunctionBlock) XMLFindElementByStringAsync (FunctionBlock) XMLGetElement (FunctionBlock) XMLGetElementAsync (FunctionBlock) XMLWrite (FunctionBlock) XMLWriteAsync (FunctionBlock)
XMLFindElement (FB) ¶ FUNCTION_BLOCK XMLFindElement Finds a xml element by name and attribute. Use the function block XMLFindElementAsync for large XML files to find the value 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 xml file wsElement WSTRING(gc_udiMaxValueSize) The element to find. if blank, the root element will be returend. attribute XMLElement Attributes of the xml element to find. readMode READ_MODE Read mode paElements POINTER TO XMLElement Pointer to the result set udiMaxElements UDINT Maximum size of paElements udiStartPosition UDINT 0 Start position in bytes 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
XMLFindElementAsync (FB) ¶ FUNCTION_BLOCK XMLFindElementAsync EXTENDS CBM.ETrig Finds a xml element by name and attribute asynchronously, i.e. distributed on several cycles. This function block should be used to find elements in large xml files. 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 Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrig Output xDone BOOL TRUE : Action successfully completed ETrig xBusy BOOL TRUE : Function block active ETrig xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrig Input sFileName STRING(255) Path to a file wsElement WSTRING(gc_udiMaxValueSize) The element to find. if blank, the root element will be returend. attribute XMLElement Attributes of the xml element to find. readMode READ_MODE Read mode paElements POINTER TO XMLElement Pointer to the result set udiMaxElements UDINT Maximum size of paElements udiStartPosition UDINT 0 Start position in bytes 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 code if xError is true eLastError ERROR The last 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
XMLFindElementByStringAsync (FB) ¶ FUNCTION_BLOCK XMLFindElementByStringAsync EXTENDS CBM.ETrig {attribute ‘hide_all_locals’} InOut: Scope Name Type Initial Comment Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrig Output xDone BOOL TRUE : Action successfully completed ETrig xBusy BOOL TRUE : Function block active ETrig xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrig Input sFileName STRING(gc_udiMaxValueSize) Path to a file wsElement STRING(gc_udiMaxValueSize) The element to find. if blank, the root element will be returend. attributeName STRING(gc_udiMaxValueSize) Name of the attribute, BLANK if not required attributeValue STRING(gc_udiMaxValueSize) Value of the attribute readMode READ_MODE Read mode paElements POINTER TO XMLElement Pointer to the result set udiMaxElements UDINT Maximum size of paElements udiStartPosition UDINT 0 Start position in bytes 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 code if xError is true eLastError ERROR The last 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
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
XMLGetElementAsync (FB) ¶ FUNCTION_BLOCK XMLGetElementAsync EXTENDS CBM.ETrig Reads a xml element from file asynchronously, i.e. distributed on several cycles. This function block should be used to get elements of large xml files. 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 Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrig Output xDone BOOL TRUE : Action successfully completed ETrig xBusy BOOL TRUE : Function block active ETrig xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrig 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 code if xError is true eLastError ERROR The last 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