HasMember

TwinCAT TIA
Local File and directory access XML reader ActiveXMLDocuments A reader

ns=2;s=DEPRAG Smart/Local/FileAndDirectoryAccess/Xml/ActiveXmlDocuments/0/HasMember

This command can be used to check whether the specified XML element is contained in the XML document.

Parameters:

Returns:

    HasMember
    A variable of the OpcMethodReturnValueBoolean type. The Result property contains the command-specific return values.
      Result
      A boolean variable that indicates whether the XML element is included in the XML document.

Examples:

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

Beckhoff parameter:

    bXmlHasMember
    A boolean variable that can be used to trigger the execution of the HasMember command.
    OutputDataXmlHasMember
    An instance of the "ST_BoolOutputData" structure into which the return value of the HasMember method is written.
    hrXmlHasMember
    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.
    XmlPath
    A variable of type ST_XmlPath, which contains the subpaths and their descriptions.
    ClientId
    A STRING(255) variable that uniquely identifies the XML document in the ActiveXmlDocuments list.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
       bXmlHasMember     : BOOL;
       OutputDataXmlHasMember   : ST_BoolOutputData;
       hrXmlHasMember     : HRESULT;
       XmlPath       : ST_XmlPath;

       fbXml        : FB_Xml;
END_VAR

XmlPath.PartialPathsLength       := 1;
XmlPath.XmlPartialpaths[0].ElementName    := 'book';  
XmlPath.XmlPartialpaths[0].AttributesLength   := 1;    
XmlPath.XmlPartialpaths[0].XmlAttribute[0].Name  := 'id'; 
XmlPath.XmlPartialpaths[0].XmlAttribute[0].Value  := 'bk102'; 

hrXmlHasMember := fbXml.HasMember(
       bExecute    := bXmlHasMember,   
       ConnectionHandle := depragSmartConnection.ConnectionHandle, 
       XmlPath    := XmlPath,         
       ClientId   := '0',
       OutputData   => OutputDataXmlHasMember);
IF hrXmlHasMember <> S_FALSE THEN 
       bXmlHasMember := 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".