[xsd-users] Assignment of optional boolean attribute does not survive on the heap; possibly a bug?

Erik Sjölund erik.sjolund at gmail.com
Wed Jun 26 08:03:23 EDT 2013


On Wed, Jun 26, 2013 at 1:07 PM, <Andreas.Hackeloeer at bmw.de> wrote:

>
>   <xs:complexType name="MapType">
>     <xs:attribute name="Title" type="xs:string" use="required" />
>     <xs:attribute name="SelectedSourceMap" type="xs:boolean"
> use="optional" />
>   </xs:complexType>
> </xs:schema>
>
>
> {
>   MapType& myMap(*i);
>   myMap.title("New Title");        // works, Title attribute keeps its new
> value
>   myMap.selectedSourceMap(true);     // does not work
>   bool problem = myMap.selectedSourceMap(); // true only as long as the
> method is being executed
> }
>
>
You could try something like:

myMap.selectedSourceMap().set(true);
if (myMap.selectedSourceMap().present()) {
   bool problem = myMap.selectedSourceMap().get();
}

cheers,
Erik Sjölund


More information about the xsd-users mailing list