[xsd-users] Changes in xsd:choice from 1.3.0 to 1.8.0 ?
Boris Kolpackov
boris at codesynthesis.com
Sun Jan 29 14:39:57 EST 2006
Filipe,
Filipe Dias <fil at immi.inesc-id.pt> writes:
> I made some code using XSD in verstion 1.3.0 to read the following portion
> of schema:
>
> <xsd:complexType name="GidesGeometry_t">
> <xsd:sequence>
> <xsd:element name="event" type="event_t" />
> <xsd:choice maxOccurs="1" minOccurs="1">
> <xsd:element name="reference" type="GidesReference_t" />
> <xsd:element name="shape" type="GidesShape_t" />
> <xsd:element name="transformation" type="GidesTransformation_t" />
> <xsd:element name="operation" type="GidesOperation_t" />
> </xsd:choice>
> </xsd:sequence>
> </xsd:complexType>
>
> The C++ code I was using is:
>
> bool ReadXSD(GidesGeometry_t *ggeom_data){
> if(ggeom_data->shape.present())
> _s = ggeom_data->shape();
> ...
> }
>
> In version 1.3.0, that 3rd line of code returned an object of type
> "GidesShape_t"
This has changed in 1.4.0 which was announced here:
http://codesynthesis.com/pipermail/xsd-users/2005-October/000054.html
If you are interested in motivation for this change, you can check
this message:
http://codesynthesis.com/pipermail/xsd-users/2005-September/000041.html
> Now, in version 1.8.0, it returns: "GidesShape_t::shape::container"
>
> How do I reach the GidesShape_t object in version 1.8.0?
You can write it like this:
if(ggeom_data->shape().present())
_s = ggeom_data->shape().get ();
or, using pointer notation,
if(ggeom_data->shape())
_s = *ggeom_data->shape();
or, if you don't want to call ggeom_data->shape() twice,
if(GidesShape_t::shape::container s = ggeom_data->shape())
_s = *s;
hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20060129/8397b202/attachment.pgp
More information about the xsd-users
mailing list