[xsd-users] Optional Cardinality Issues

Boris Kolpackov boris at codesynthesis.com
Tue Apr 21 08:36:26 EDT 2009


Hi,

jatkins <jatkins at wintelligence.org> writes:

> <WLANProfile xmlns="...">
>         <name>linksys</name>
>         <SSIDConfig>
>                 <SSID>
>                         <hex>6C696E6B737973</hex>
>                         <name>linksys</name>
>                 </SSID>
>         </SSIDConfig>
>         <connectionType>ESS</connectionType>
>         <MSM>
>                 <security>
>                         <authEncryption>
>                                 <authentication>open</authentication>
>                                 <encryption>none</encryption>
>                                 <useOneX>false</useOneX>
>                         </authEncryption>
>                 </security>
>         </MSM>
> </WLANProfile>
> 
> [...]
> 
> 
> WLANProfile wlprofile(L"linksys", L"ESS");
> 
> The MSM section goes deeper and appears to be optional cardinality. How
> would I populate this information from scratch?

It is actually even easier than the sequence cardinality. You simply
need to create the MSM object and then call WLANProfile::MSM() setter
to set it. In fact the most straightforward way to handle such deep
object models is to start from the inside and work your way out:

authEncryption ae ("open", "none");
ae.useOneX (false);

security s;
s.authEncryption (ae);

MSM msm;
msm.security (s);

wlprofile.MSM (msm);

Boris




More information about the xsd-users mailing list