FB_XmlRead Rules and Constraints

Rules and Constraints

Comply with the following constraints for reading an XML file:

  • Only XML files with ASCII encoding are supported.

  • Blank spaces are interpreted as values, tabs are not interpreted as values.

  • Line breaks in values are not supported. If a value includes a line break, the characters before the line break are considered during parsing.

  • Only the names of elements and their attributes together with their values are read and then stored in the buffer provided by the application. This has the effect that XML objects other than elements and attributes, such as comments, and DOCTYPE declarations are not detected by the XML parser.

  • CDATA objects are not supported. The content of CDATA objects is interpreted as a value of the open element.

  • The values read from the file are stored as STRING values in the application. This applies even to numeric values. Before they can be processed, the values need to be converted to the appropriate datatype. To achieve this, it is a good practice to use the STRING_TO_ conversion functions. The conversion functions require a specific syntax of the STRING values depending on the target datatype. Consider these requirements when creating the files to simplify the processing of read values.

  • Parsing the XML file is a time-consuming process. It is performed in parallel to the task that calls the function block. Thus, the time required for parsing is part of the task execution time. It results, for a single cycle, in an increased task execution time while the FB_XmlRead function block is executed. Depending on the size of the file and the controller, the increased task cycle can take up to a few seconds. To help prevent other processes from being blocked by parsing an XML file, create a separate task with low priority (>24) for this function. In addition, consider whether the watchdog for this task may be disabled to avoid watchdog exceptions during the parsing process. For more information, refer to the chapter System and Task Watchdogs in the Programming Guide of your controller.

  • Do not process the data from the buffer provided via i_refXmlItems as long as the output q_xBusy of function block indicates TRUE.

  • Do not access the same file with different function blocks at the same time. Use the output q_xBusy to lock the execution of different function blocks.