Pyxb generating multiple complex types in a loop
<p>I have a data structure where values of a certain complex type (let's call it <code>myComplexType</code>) are stored in a list.  <code>myComplexType</code> is under another complex type (called <code>complexType1</code>) which is under the "root" i.e (<code>RootName -&gt; complexType1 -&gt; myComplexType</code>)  </p>

<p>I am trying to create a loop where the values that I gathered from reading a data file will fill out this complex type.  However, this complex type has a minimum occurrence of 1 and a maximum occurrence of 4.  </p>

<p>The code I have goes something like this:</p>

<pre><code>root = module.RootName():
for a,b,c,d,e,f,g,h in zip(A,B,C,D,E,F,G,H):
    for d1,e1,f1 in zip(d,e,f):
        root.complexType1_name.append(module.complexType1(a,b,c,(myComplexType(d1,e1,f1))),g,h)
</code></pre>

<p>How can I create "n" number of <code>myComplexType</code> where "n" is the length of the nested lists d,e,f?</p>

<p>Further clarification:</p>

<pre><code>A = [1,2,3,4]
B = [Blue,Red,Orange,Yellow]
C = ['cat', 'dog', 'mouse', 'bird']
D = [[0,1],[0],[1,12,1,2],[2,0,4]]
E = [[Red,Blue],[Yellow],[Orange,Black,Red,White],[Blue,Green,Violet]]
F = [[True,False],[False],[False,True,False,False],[True,True,False]]
G = [0,0,1,0]
H = [1,0,1,1]
</code></pre>

<p>I need something like this:</p>

<pre><code>&lt;Root&gt;
&lt;complexType1&gt;
    &lt;A_value&gt; 1 &lt;/A_value&gt;
    &lt;B_value&gt; Blue &lt;/B_value&gt;
    &lt;C_value&gt; cat &lt;/C_value&gt;
    &lt;myComplexType&gt;
        &lt;D_value&gt; 0 &lt;D_value&gt;
        &lt;E_value&gt; Red &lt;E_value&gt;
        &lt;F_value&gt; True &lt;F_value&gt;
    &lt;/myComplexType&gt;
    &lt;myComplexType&gt;
        &lt;D_value&gt; 1 &lt;D_value&gt;
        &lt;E_value&gt; Blue &lt;E_value&gt;
        &lt;F_value&gt; False &lt;F_value&gt;
    &lt;/myComplexType&gt;
    &lt;G_value&gt; 0 &lt;G_value&gt;
    &lt;H_value&gt; 1 &lt;H_value&gt;
&lt;/complexType1&gt;
&lt;complexType1&gt;
    &lt;A_value&gt; 2 &lt;/A_value&gt;
    &lt;B_value&gt; Red &lt;/B_value&gt;
    &lt;C_value&gt; dog &lt;/C_value&gt;
    &lt;myComplexType&gt;
        &lt;D_value&gt; 0 &lt;D_value&gt;
        &lt;E_value&gt; Yellow &lt;E_value&gt;
        &lt;F_value&gt; False &lt;F_value&gt;
    &lt;/myComplexType&gt;
    &lt;G_value&gt; 0 &lt;G_value&gt;
    &lt;H_value&gt; 0 &lt;H_value&gt;
&lt;/complexType1&gt;
&lt;complexType1&gt;
    &lt;A_value&gt; 3 &lt;/A_value&gt;
    &lt;B_value&gt; Orange &lt;/B_value&gt;
    &lt;C_value&gt; mouse &lt;/C_value&gt;
    &lt;myComplexType&gt;
        &lt;D_value&gt; 1 &lt;D_value&gt;
        &lt;E_value&gt; Orange &lt;E_value&gt;
        &lt;F_value&gt; False &lt;F_value&gt;
    &lt;/myComplexType&gt;
    &lt;myComplexType&gt;
        &lt;D_value&gt; 12 &lt;D_value&gt;
        &lt;E_value&gt; Black &lt;E_value&gt;
        &lt;F_value&gt; True &lt;F_value&gt;
    &lt;/myComplexType&gt;
    &lt;myComplexType&gt;
        &lt;D_value&gt; 1 &lt;D_value&gt;
        &lt;E_value&gt; Red &lt;E_value&gt;
        &lt;F_value&gt; False &lt;F_value&gt;
    &lt;/myComplexType&gt;
    &lt;myComplexType&gt;
        &lt;D_value&gt; 2 &lt;D_value&gt;
        &lt;E_value&gt; White &lt;E_value&gt;
        &lt;F_value&gt; False &lt;F_value&gt;
    &lt;/myComplexType&gt;
    &lt;G_value&gt; 1 &lt;G_value&gt;
    &lt;H_value&gt; 0 &lt;H_value&gt;
&lt;/complexType1&gt;
&lt;complexType1&gt;
    &lt;A_value&gt; 4 &lt;/A_value&gt;
    &lt;B_value&gt; Yellow &lt;/B_value&gt;
    &lt;C_value&gt; bird &lt;/C_value&gt;
    &lt;myComplexType&gt;
        &lt;D_value&gt; 2 &lt;D_value&gt;
        &lt;E_value&gt; Blue &lt;E_value&gt;
        &lt;F_value&gt; True &lt;F_value&gt;
    &lt;/myComplexType&gt;
    &lt;myComplexType&gt;
        &lt;D_value&gt; 0 &lt;D_value&gt;
        &lt;E_value&gt; Green &lt;E_value&gt;
        &lt;F_value&gt; True &lt;F_value&gt;
    &lt;/myComplexType&gt;
    &lt;myComplexType&gt;
        &lt;D_value&gt; 4 &lt;D_value&gt;
        &lt;E_value&gt; Violet &lt;E_value&gt;
        &lt;F_value&gt; False &lt;F_value&gt;
    &lt;/myComplexType&gt;
    &lt;G_value&gt; 0 &lt;G_value&gt;
    &lt;H_value&gt; 1 &lt;H_value&gt;
</code></pre>

<p>Can anyone show me how to easily create an "n" number of <code>myComplexType</code> (based on the length of the nested loops d, e, f) for each iteration/<code>complexType1</code> in my loop?</p>

<p>Please let me know if there is any confusion so that I may attempt to clarify further.</p>

<p>Thanks in advance.</p>