Porting XML data model from C# to C++
Moderator: uasdkcpp
-
- Hero Member
- Posts: 25
- Joined: 14 Oct 2008, 12:55
Porting XML data model from C# to C++
Hi
I have a huge XML (more than 6000 lines) defining the data model of my server which is written in C# using the OPC Foundation SDK. Now I want to move it on your C++ SDK to be able to run it under Linux. Is it possible the use the OPC Foundation XML format with your C++ SDK?
a) Yes or No
b) Is there any restrictions
c) Shall I convert it to another format? Can it be done automatically?
Thanks
I have a huge XML (more than 6000 lines) defining the data model of my server which is written in C# using the OPC Foundation SDK. Now I want to move it on your C++ SDK to be able to run it under Linux. Is it possible the use the OPC Foundation XML format with your C++ SDK?
a) Yes or No
b) Is there any restrictions
c) Shall I convert it to another format? Can it be done automatically?
Thanks
Last edited by Lafond on 07 Feb 2013, 10:48, edited 1 time in total.
- Support Team
- Hero Member
- Posts: 3068
- Joined: 18 Mar 2011, 15:09
Re:Porting XML data model from C# to C++
Hello,
The answer depends on the format you are using and the use case you have in mind.
There are different XML schemas used by the OPC Foundation.
(1) Input format for the Model Designer (Opc.Ua.ModelDesigner.exe)(http://opcfoundation.org/UA/ModelDesign.xsd)
This is the format to describe an OPC UA Model in a simplified, readable XML format. This format is used to generate code and another XML file containing all nodes. This generation is done with the ModelDesigner provided by the OPC Foundation
(2) NodeSet format (http://opcfoundation.org/UA/2008/02/Types.xsd)
This is the output XML format of the Model Designer
(3) I think there is another schema but I do not know much about it
Unified Automation provides the tool UaModeler.
You can find the download here: http://www.unified-automation.com/opc-ua-development/
This tool can load the XML format (2). You can generate (2) from (1) with the Model Designer from the OPC Foundation.
The UaModeler can already generate C++ classes for most of the OPC UA node types. The generated code can be used with the SDK. The first version that supports this code generation is the C++ SDK V1.3
You can not generate custom reference types and custom data types at the moment. Version 1.3.1 will support custom reference types and enumeration data types. V1.4 will also support structure data types.
The tool can also generate code for the ANSI C SDK from the same model file.
There is also sample code available on request to load the XML format (2) into a NodeManager. This sample code is using the Qt XML parser at the moment but it should be no big effort to replace the code with the libxml parser that is used in the SDK sample code.
Please let us know if one of the two options can solve your requirement. The sample code can be provided on request.
Best Regards,
Unified Automation support team
The answer depends on the format you are using and the use case you have in mind.
There are different XML schemas used by the OPC Foundation.
(1) Input format for the Model Designer (Opc.Ua.ModelDesigner.exe)(http://opcfoundation.org/UA/ModelDesign.xsd)
This is the format to describe an OPC UA Model in a simplified, readable XML format. This format is used to generate code and another XML file containing all nodes. This generation is done with the ModelDesigner provided by the OPC Foundation
(2) NodeSet format (http://opcfoundation.org/UA/2008/02/Types.xsd)
This is the output XML format of the Model Designer
(3) I think there is another schema but I do not know much about it
Unified Automation provides the tool UaModeler.
You can find the download here: http://www.unified-automation.com/opc-ua-development/
This tool can load the XML format (2). You can generate (2) from (1) with the Model Designer from the OPC Foundation.
The UaModeler can already generate C++ classes for most of the OPC UA node types. The generated code can be used with the SDK. The first version that supports this code generation is the C++ SDK V1.3
You can not generate custom reference types and custom data types at the moment. Version 1.3.1 will support custom reference types and enumeration data types. V1.4 will also support structure data types.
The tool can also generate code for the ANSI C SDK from the same model file.
There is also sample code available on request to load the XML format (2) into a NodeManager. This sample code is using the Qt XML parser at the moment but it should be no big effort to replace the code with the libxml parser that is used in the SDK sample code.
Please let us know if one of the two options can solve your requirement. The sample code can be provided on request.
Best Regards,
Unified Automation support team
Last edited by Support Team on 07 Feb 2013, 10:48, edited 1 time in total.
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Jr. Member
- Posts: 1
- Joined: 28 Sep 2011, 14:17
Re:Porting XML data model from C# to C++
Hello,
we are also interested on the possibility to load an xml file that include the \"configuration\" of the opc-ua server (Linux C/C++ Platforms). This has the important advantage to bypass the code generation and necessary new compilation. Can you send us the sample code?
Thanks
we are also interested on the possibility to load an xml file that include the \"configuration\" of the opc-ua server (Linux C/C++ Platforms). This has the important advantage to bypass the code generation and necessary new compilation. Can you send us the sample code?
Thanks
Last edited by nicola.vicino on 07 Feb 2013, 10:48, edited 1 time in total.
- Support Team
- Hero Member
- Posts: 3068
- Joined: 18 Mar 2011, 15:09
Re:Porting XML data model from C# to C++
Hello Nicola,
The OPC Foundation is currently defining a standard XML schema for storing / exporting / importing OPC UA nodes.
This new format will be used in future versions of the UaModeler as standard file format. The next UaModeler will already support the format but the schema is not released yet. We have also classes for the SDK that can load that XML format directly into the address space without code generation.
Best Regards,
Unified Automation support team
The OPC Foundation is currently defining a standard XML schema for storing / exporting / importing OPC UA nodes.
This new format will be used in future versions of the UaModeler as standard file format. The next UaModeler will already support the format but the schema is not released yet. We have also classes for the SDK that can load that XML format directly into the address space without code generation.
Best Regards,
Unified Automation support team
Last edited by Support Team on 07 Feb 2013, 10:48, edited 1 time in total.
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Jr. Member
- Posts: 1
- Joined: 10 Aug 2012, 14:35
Re:Porting XML data model from C# to C++
Hello,
Please let me know which classes loads the XML format directly into the address space without code generation.
Thanks in advance
David
Please let me know which classes loads the XML format directly into the address space without code generation.
Thanks in advance
David
- Support Team
- Hero Member
- Posts: 3068
- Joined: 18 Mar 2011, 15:09
Re:Porting XML data model from C# to C++
Hello David,
The classes for loading the model will be part of the next major release 1.4.
A first version of the classes was already finished but feedback from beta users need to be integrated. Therefore the final version will change.
Best Regards
Unified Automation Support Team
The classes for loading the model will be part of the next major release 1.4.
A first version of the classes was already finished but feedback from beta users need to be integrated. Therefore the final version will change.
Best Regards
Unified Automation Support Team
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Sr. Member
- Posts: 13
- Joined: 30 May 2013, 18:27
Re: Porting XML data model from C# to C++
UA Support Team,
I am interested in the XML import functionality as well. Would it be possible to get more information on this functionality?
Thanks
Dan
I am interested in the XML import functionality as well. Would it be possible to get more information on this functionality?
Thanks
Dan
-
- Hero Member
- Posts: 37
- Joined: 30 Sep 2013, 08:19
Re: Porting XML data model from C# to C++
Hello,
is there any update of importing information models by loading a .xml in the c++ sdk? Can you provide some sample code for doing this?
is there any update of importing information models by loading a .xml in the c++ sdk? Can you provide some sample code for doing this?
- Support Team
- Hero Member
- Posts: 3068
- Joined: 18 Mar 2011, 15:09
Re: Porting XML data model from C# to C++
Hello,
this functionality will be included in the new release v1.4 for the C++ based SDK planned for this month.
Best regards
Support Team
this functionality will be included in the new release v1.4 for the C++ based SDK planned for this month.
Best regards
Support Team
-
- Sr. Member
- Posts: 13
- Joined: 02 Oct 2014, 09:08
Re: Porting XML data model from C# to C++
This UANodeSet type of xml file, does it contain all the interface information between client and server?
Can it be seen as the interface specification (in combination with the OPC UA spec itself of course)?
In other words, having only such an xml file, could a client (proxy) class be made?
Regards, Patrick
Can it be seen as the interface specification (in combination with the OPC UA spec itself of course)?
In other words, having only such an xml file, could a client (proxy) class be made?
Regards, Patrick
- Support Team
- Hero Member
- Posts: 3068
- Joined: 18 Mar 2011, 15:09
Re: Porting XML data model from C# to C++
Hi Patrick,
XML files based on the UANodeSet XML schema provide all information about Nodes a OPC UA client can get through Browse and Read from an OPC UA server. It contains the attribute values and references of the nodes.
If you see the type nodes as interface definition, you can create proxy classes for clients out of the type related nodes in an XML files based on the UANodeSet XML schema.
Best Regards,
Unified Automation Support Team
XML files based on the UANodeSet XML schema provide all information about Nodes a OPC UA client can get through Browse and Read from an OPC UA server. It contains the attribute values and references of the nodes.
If you see the type nodes as interface definition, you can create proxy classes for clients out of the type related nodes in an XML files based on the UANodeSet XML schema.
Best Regards,
Unified Automation Support Team
-
- Full Member
- Posts: 7
- Joined: 22 Mar 2019, 09:34
Re: Porting XML data model from C# to C++
Hello,
is there any update of importing information models by loading a .xml in the c++ sdk?
The basic import is working in my server already but I have Problems with Variables of Type Enumeration and Structure. I tried to load an xml nodeset that contains an Instance with a variable, that has a predefined Enumerationvalue (for example "off"). In the UaExpert Client I only see the Integervalue not the stringvalue. How am I able to change that in code if I did not define the Enumeration in the code but only loaded it in from a xml nodeset. If there is a possibility could you provide some sample code for doing this?
Thank you!
Best Regards
is there any update of importing information models by loading a .xml in the c++ sdk?
The basic import is working in my server already but I have Problems with Variables of Type Enumeration and Structure. I tried to load an xml nodeset that contains an Instance with a variable, that has a predefined Enumerationvalue (for example "off"). In the UaExpert Client I only see the Integervalue not the stringvalue. How am I able to change that in code if I did not define the Enumeration in the code but only loaded it in from a xml nodeset. If there is a possibility could you provide some sample code for doing this?
Thank you!
Best Regards