[xsd-users] Re: Accessing elements in sequence of choices. Elements are complex types

B Hart bhartsb at gmail.com
Thu Mar 15 14:35:16 EDT 2012


Here is what the actual iterating code looks like:

for (E19::E19_01_0_iterator itemp ((*iC)->E19().E19_01_0().begin()); itemp
!= ((*iC)->E19().E19_01_0().end()); ++itemp)
 {
          // I want to access each instance of E19_01_0 (*itemp), to look
for and further access P89_701 (if it exists)
 }

Thanks.

On Thu, Mar 15, 2012 at 10:21 AM, B Hart <bhartsb at gmail.com> wrote:

> Hi Erik,
>
> There is a function just as you mention, but could you explain the
> "object" part?  Is object a root element in the DOM, or something else?
>
> If I put the code snippet in I get errors.  I can declare a variable like:
>
> SBC::P89_701 var;
>
> without generating errors.
>
> On Thu, Mar 15, 2012 at 9:33 AM, Erik Sjölund <erik.sjolund at gmail.com>wrote:
>
>> If understand you correctly you, Codesynthesis XSD has probably
>> generated the function
>>
>>   const P89_701_optional&  P89_701 () const;
>>
>> (Take a look in the generated header file)
>>
>> You could use it like this
>>
>> if (object.P89_701().present()) {
>>  const P89_701 &var = object.P89_701().get();
>> }
>>
>> cheers,
>> Erik Sjölund
>>
>>
>


More information about the xsd-users mailing list