OpenXmlDocument

TwinCAT
Local File and directory access XML reader

ns=2;s=DEPRAG Smart/Local/FileAndDirectoryAccess/Xml/OpenXmlDocument

The command opens an XML file for further processing. The reader can be retrieved from the "ActiveXMLDocuments" list via the returned index.

Parameters:

Returns:

    OpenXmlDocument
    A variable of type OpcMethodReturnValueInt32. The Result property contains the command-specific return values.
      Result
      Unique index to retrieve the XML document in the ActiveXmlDocuments list.

Examples:

In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:

Beckhoff parameter:

    bXmlOpenXmlDocument
    A boolean variable that can be used to trigger the execution of the OpenXmlDocument command.
    OutputDataXmlOpenXmlDocument
    An instance of the "ST_VoidOutputData" structure into which the return value of the OpenXmlDocument method is written.
    hrXmlOpenXmlDocument
    This can be used to monitor the execution of the command. Error codes have the type "HRESULT".
    fbXml
    An instance of the "FB_Xml" function block supplied with the DEPRAG Smart library.
    sfullFilePath
    A STRING variable containing the path of the XML file.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
       bXmlOpenXmlDocument    : BOOL;
       OutputDataXmlOpenXmlDocument : ST_XmlDocumentOutputData;
       hrXmlOpenXmlDocument   : HRESULT;

       fbXml        : FB_Xml;
END_VAR

hrXmlOpenXmlDocument := fbXml.OpenXmlDocument(
        bExecute    := bXmlOpenXmlDocument,   
        ConnectionHandle := depragSmartConnection.ConnectionHandle, 
        sfullFilePath  := 'C:\Test\Test.xml',
        OutputData   => OutputDataXmlOpenXmlDocument);
IF hrXmlOpenXmlDocument <> S_FALSE THEN 
       bXmlOpenXmlDocument := FALSE;
END_IF
                                                    

For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".