Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

XML file to initialization value

2021-10-05
2021-10-06
  • jeffersonhui - 2021-10-05

    Hi,

    Is it possible to parse a specific value from an XML file (or another type of file) and write the value as initialization value in the declaration of a variable?

    Thanks,
    Jefferson

     
  • dFx

    dFx - 2021-10-05

    You can read a file at first scan, but as file operations are asynchronous (takes more than one task cycle), you need to add some code to block the execution requiring the variable to be correctly initialized.

     
  • jeffersonhui - 2021-10-05

    How do I read from the XML file?

     
  • jeffersonhui - 2021-10-05

    Also, I am testing the XML Utility library. I downloaded this free library from the Codesys store and installed the package, but the library says that I need a license:

     
  • dFx

    dFx - 2021-10-06

    As you stated :

    an XML file (or another type of file)

    So I beg you may use some easier format to read, or just do some string search to the property you need, without using DOM.

     

Log in to post a comment.