XML elements that have the colon :
are bound to a namespace and are using a namespace-prefix. The value before the :
is the namespace-prefix, which is like a variable referencing a namespace value.
There are a couple of ways to create an element bound to a namespace.
Instead of a string for the element name, you can provide a QName():
from xml.etree import ElementTree as ET
IDS_NS = "http://whatever/the/IDS/namespace/value/is" #adjust this to the real IDS NS
ET.register_namespace("IDS", IDS_NS)
et.SubElement(root, et.QName(IDS_NS, "OwnedPropertyRentNetCust"))
Use Clark notation, which includes the namespace and the element's local-name()
in the string value:
from xml.etree import ElementTree as ET
IDS_NS = "http://whatever/the/IDS/namespace/value/is"
ET.register_namespace("IDS", IDS_NS)
et.SubElement(root, "{http://whatever/the/IDS/namespace/value/is}OwnedPropertyRentNetCust")