I am attempting to add an element to some XML using ElementTree.
<device>
<general>
<item1>text</item1>
</general>
</device>
I want to add <item2>text</item2> under general.
I tried
ElementTree.SubElement(xml, '/device/general/item2')
ElementTree.SubElement(xml, 'general/item2')
to add the field in but both added new lines at the end of the XML rather than adding inside the existing general element.
Any ideas what I'm doing wrong?