Hit ENTER after each Tag to add it to your post; Numbers in parentheses represent the Tag's usage.
I have a 3rd party XSD (cannot provide full XDS but will attempt to provide sensible snippets) that defines an element with the nillable attribute:
<xs:element name="locationType" nillable="true">
<xs:simpleContent msdata:ColumnName="locationType_Text" msdata:Ordinal="4">
<xs:attribute name="units" type="xs:string" use="required" />
<xs:attribute name="datum" type="xs:string" />
<xs:attribute name="zone" type="xs:string" />
<xs:attribute name="north" type="xs:string" />
This element is then used in other elements such as:
<xs:element name="LocationDefinition" minOccurs="0" maxOccurs="1">
<xs:element ref="locationType" minOccurs="1" maxOccurs="1" />
When XSD is processed by the Data Binder to produce C++ code, it appears to create both CLocationType and CLocationType_nillable classes and the relevant CSmartPtr<class> typedefs.
The class generated for LocationDefinition has get/set methods for LocationType but these methods only return/take a LocationType_nillable pointer.
When the XML string is generated for TopLevelElement where a LocationDefinition has been added, the XML looks something like:
<locationType_nillable units="someunits" datum="somedatum" north="Grid">GPS</locationType_nillable>
The above is not what I expected. The locationType within the LocationDefinition should not have the "_nillable" in its element name.
I would have expected the LocationType class to have had a SetIsNil(bool) method and GetIsNil() method that returns a bool but it is only the LocationType_nillable class that has these.
The CLocationDefinition::SetLocationType(...) method will not take a CLocationType* as the parameter, only a CLocationType_nillable*
The only way I have found to make the XML acceptable to the 3rd party server receiving the XML is to override the name of the element when creating CLocationType_nillable object with CLocationType_nillable::CreateInstance("locationType") before passing it to CLocationDefinition::SetLocationType(...) but having to do this does not seem right to me.
Am I doing something wrong in the data binder or use of the generated C++ library?