I had been working on SDK C++ Bundle evaluation 1.5.0, and I tried the exmaples under VS2012 both on client and server side. Now I want to write a demo client that can read nodes' attributes from server and export nodes' attributes to xml file whose format is as same as the xml file that demo server used in "bin" folder. I used xmlparser interface to export node attributes, it worked well with simple data type nodes. But when node carries a structed variable that variable type is extensionObject, I don't know how to transfer the extension object into xml format. The structed data in xml file that demo server used requires each fields' name and value, how can I get those information from extension object?
I noted that there are two functions "xml" and "changeEncoding" in class UaExtensionObject, but currently only binary format encoding is supported. Should I map each complex dataType id into corresponding structure mannually, or there is a easier way to encode extension object into xml format?
Thanks.
how to export stucted variable to xml format
Moderator: uasdkcpp
-
- Jr. Member
- Posts: 2
- Joined: 03 Apr 2016, 12:21
- Support Team
- Hero Member
- Posts: 3071
- Joined: 18 Mar 2011, 15:09
Re: how to export stucted variable to xml format
Hi,
There is currently no XML encoding/decoding implemented in the ANSI C stack and therefore also not available in the C++ or ANSI C SDK.
But the C++ SDK allows you to write generic code for structure handling by using the classes UaGenericStructureValue and UaStructureDefinition. The class UaGenericStructureValue decodes any unknown structure from a server to a name value pair list and the class UaStructureDefinition provides access to the details of the structure data type.
http://documentation.unified-automation ... Value.html
http://documentation.unified-automation ... ition.html
The use on the client side is shown in the following sample code:
http://documentation.unified-automation ... ample.html
File callback.h
Function printGenericStructureValue()
Best Regards,
Unified Automation Support Team
There is currently no XML encoding/decoding implemented in the ANSI C stack and therefore also not available in the C++ or ANSI C SDK.
But the C++ SDK allows you to write generic code for structure handling by using the classes UaGenericStructureValue and UaStructureDefinition. The class UaGenericStructureValue decodes any unknown structure from a server to a name value pair list and the class UaStructureDefinition provides access to the details of the structure data type.
http://documentation.unified-automation ... Value.html
http://documentation.unified-automation ... ition.html
The use on the client side is shown in the following sample code:
http://documentation.unified-automation ... ample.html
File callback.h
Function printGenericStructureValue()
Best Regards,
Unified Automation Support Team
-
- Jr. Member
- Posts: 2
- Joined: 03 Apr 2016, 12:21
Re: how to export stucted variable to xml format
--------------------------------------------------Support Team wrote:Hi,
There is currently no XML encoding/decoding implemented in the ANSI C stack and therefore also not available in the C++ or ANSI C SDK.
But the C++ SDK allows you to write generic code for structure handling by using the classes UaGenericStructureValue and UaStructureDefinition. The class UaGenericStructureValue decodes any unknown structure from a server to a name value pair list and the class UaStructureDefinition provides access to the details of the structure data type.
http://documentation.unified-automation ... Value.html
http://documentation.unified-automation ... ition.html
The use on the client side is shown in the following sample code:
http://documentation.unified-automation ... ample.html
File callback.h
Function printGenericStructureValue()
Best Regards,
Unified Automation Support Team
Thanks for your relay, it helps a lot.
I will try it out.