I have the following XML that I am trying to recreate with the lxml.objectify package
<file>
<customers>
<customer>
<phone>
<type>home</type>
<number>555-555-5555</number>
</phone>
<phone>
<type>cell</type>
<number>999-999-9999</number>
</phone>
<phone>
<type>home</type>
<number>111-111-1111</number>
</phone>
</customer>
</customers>
</file>
I can't figure out how to create the phone element multiple times. Basically, I have the following non-working code:
# create phone element 1
root.customers.customer.phone = ""
root.customers.customer.phone.type = data_dict['PRIMARY PHONE1']
root.customers.customer.phone.number = data_dict['PRIMARY PHONE TYPE 1']
# create phone element 2
root.customers.customer.phone = ""
root.customers.customer.phone.type = data_dict['PRIMARY PHONE2']
root.customers.customer.phone.number = data_dict['PRIMARY PHONE TYPE 2']
# create phone element 3
root.customers.customer.phone = ""
root.customers.customer.phone.type = data_dict['PRIMARY PHONE3']
root.customers.customer.phone.number = data_dict['PRIMARY PHONE TYPE 3']
Which of course only outputs one section of phone information in the resulting XML. Does anyone have any ideas?