how to export stucted variable to xml format

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
stvaldez
Jr. Member
Jr. Member
Posts: 2
Joined: 03 Apr 2016, 12:21

how to export stucted variable to xml format

Post by stvaldez »

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.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3071
Joined: 18 Mar 2011, 15:09

Re: how to export stucted variable to xml format

Post by Support Team »

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

stvaldez
Jr. Member
Jr. Member
Posts: 2
Joined: 03 Apr 2016, 12:21

Re: how to export stucted variable to xml format

Post by stvaldez »

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.

Post Reply