Below is an example with several approaches that work for me. I've
also added some comments in context explaining why what you tried
didn't work.
import items
inv = items.items()
# can't have empty inventory; need minOccurs="0"
#print inv.toxml()
i1 = items.Item(name="cheese", price="50")
inv.i
I also tried to use the append method() :
inv = items.Items()
inv.item.append(i1)
inv.item.append(i2)
print(inv.toxml())
This time, the error comes from toxml() :
Traceback (most recent call last):
File "test2.py", line 9, in
print(inv.toxml())
File "C:\Documents and Settings\sgadioux\A