xml ns0: prefix cant make the previous solutions work
<p>i know there are several questions that are already answered about this topic but for some reason i cant make it work when i read the file. </p>

<p>this is the code i have </p>

<pre><code>import xml.etree.ElementTree as etree
import copy
etree.register_namespace("","http://www.w3.org/2001/XMLSchema")
etree.register_namespace("","http://www.w3.org/2001/XMLSchema-instance")
#Estract the search set thats necesary
tree=etree.ElementTree()
tree.parse('Selection Sets.xml')
root = tree.getroot()
#QTO with one set name and properties as needed, same properties will be applied to the new elements
itree=etree.ElementTree()
itree.parse('New QTO one set.xml')
iroot=itree.getroot()
print (etree.tostring(iroot))
#----Extract the names to be used in the new sets
catcher=[]
temp=tree.findall('selectionsets/selectionset')
for child in temp:
    catcher.append(str(child.get("name")))
# print (catcher)
#----create new elements inside the QTO xml
'''itemp=iroot.findall("Takeoff/Catalog")
for isets in itemp:
    for icatch in catcher:
        col = copy.deepcopy(isets)
        col.set('Name','%s'%(icatch))
        iroot.find('Takeoff/Catalog/Item').append(col)'''
print (catcher[0])
otree = etree.ElementTree(iroot)
otree.write('Set QTO.xml')
</code></pre>

<hr>

<p>this is the original xml file structure</p>

<pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Takeoff xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://download.autodesk.com/us/navisworks/schemas/nw-TakeoffCatalog-10.0.xsd"&gt;
    &lt;Catalog&gt;
        &lt;Item Name="Column Location D" WBS="1" Transparency="0.3" Color="-3887691" LineThickness="0.1" CatalogId="f9f30bfc-6c43-4b7b-a335-5c5c093b4165"&gt;
            &lt;VariableCollection&gt;
                &lt;Variable Name="Length" Formula="=ModelLength" Units="Meter" /&gt;
                &lt;Variable Name="Width" Formula="=ModelWidth" Units="Meter" /&gt;
                &lt;Variable Name="Thickness" Formula="=ModelThickness" Units="Meter" /&gt;
                &lt;Variable Name="Height" Formula="=ModelHeight" Units="Meter" /&gt;
                &lt;Variable Name="Perimeter" Formula="=ModelPerimeter" Units="Meter" /&gt;
                &lt;Variable Name="Area" Formula="=ModelArea" Units="SquareMeter" /&gt;
                &lt;Variable Name="Volume" Formula="=ModelVolume" Units="CubicMeter" /&gt;
                &lt;Variable Name="Weight" Formula="=ModelWeight" Units="Kilogram" /&gt;
                &lt;Variable Name="Count" Formula="=1" /&gt;
            &lt;/VariableCollection&gt;
        &lt;/Item&gt;
    &lt;/Catalog&gt;
    &lt;ConfigFile&gt;
        &lt;Workbook xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://download.autodesk.com/us/navisworks/schemas/nw-TakeoffConfiguration-10.0.xsd" xmlns=""&gt;
            &lt;GlobalConfiguration&gt;
                &lt;ConfigureFileType&gt;ItemResources&lt;/ConfigureFileType&gt;
                &lt;UnitsSystem&gt;Metric&lt;/UnitsSystem&gt;
                &lt;Currency&gt;
                    &lt;Name&gt;&lt;/Name&gt;
                    &lt;Code&gt;&lt;/Code&gt;
                    &lt;Symbol&gt;&lt;/Symbol&gt;
                &lt;/Currency&gt;
                &lt;Column Name="Object"&gt;
                    &lt;Type&gt;String&lt;/Type&gt;
                    &lt;Purpose&gt;Input&lt;/Purpose&gt;
                    &lt;Formula varies="0"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="any"&gt;&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="Description1"&gt;
                    &lt;Type&gt;String&lt;/Type&gt;
                    &lt;Purpose&gt;Input&lt;/Purpose&gt;
                    &lt;Formula varies="0"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="any"&gt;&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="Description2"&gt;
                    &lt;Type&gt;String&lt;/Type&gt;
                    &lt;Purpose&gt;Input&lt;/Purpose&gt;
                    &lt;Formula varies="0"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="any"&gt;&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="ModelLength"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Input&lt;/Purpose&gt;
                    &lt;Formula varies="0"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="length"&gt;meter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="ModelWidth"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Input&lt;/Purpose&gt;
                    &lt;Formula varies="0"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="length"&gt;meter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="ModelThickness"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Input&lt;/Purpose&gt;
                    &lt;Formula varies="0"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="length"&gt;meter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="ModelHeight"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Input&lt;/Purpose&gt;
                    &lt;Formula varies="0"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="length"&gt;meter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="ModelPerimeter"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Input&lt;/Purpose&gt;
                    &lt;Formula varies="0"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="length"&gt;meter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="ModelArea"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Input&lt;/Purpose&gt;
                    &lt;Formula varies="0"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="area"&gt;squaremeter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="ModelVolume"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Input&lt;/Purpose&gt;
                    &lt;Formula varies="0"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="volume"&gt;cubicmeter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="ModelWeight"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Input&lt;/Purpose&gt;
                    &lt;Formula varies="0"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="weight"&gt;kilogram&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="Length"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;=ModelLength&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="1" group="length"&gt;meter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="Width"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;=ModelWidth&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="1" group="length"&gt;meter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="Thickness"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;=ModelThickness&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="1" group="length"&gt;meter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="Height"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;=ModelHeight&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="1" group="length"&gt;meter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="Perimeter"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;=ModelPerimeter&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="1" group="length"&gt;meter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="Area"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;=ModelArea&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="1" group="area"&gt;squaremeter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="Volume"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;=ModelVolume&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="1" group="volume"&gt;cubicmeter&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="Weight"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;=ModelWeight&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="1" group="weight"&gt;kilogram&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="Count"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="0" group="any"&gt;count&lt;/Units&gt;
                &lt;/Column&gt;
                &lt;Column Name="PrimaryQuantity"&gt;
                    &lt;Type&gt;Number&lt;/Type&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Value varies="1"&gt;&lt;/Value&gt;
                    &lt;Units varies="1" group="any"&gt;&lt;/Units&gt;
                &lt;/Column&gt;
            &lt;/GlobalConfiguration&gt;
            &lt;Table Name="ObjectResource"&gt;
                &lt;ColumnRef Name="Object" /&gt;
                &lt;ColumnRef Name="Description1" /&gt;
                &lt;ColumnRef Name="Description2" /&gt;
                &lt;ColumnRef Name="ModelLength" /&gt;
                &lt;ColumnRef Name="ModelWidth" /&gt;
                &lt;ColumnRef Name="ModelThickness" /&gt;
                &lt;ColumnRef Name="ModelHeight" /&gt;
                &lt;ColumnRef Name="ModelPerimeter" /&gt;
                &lt;ColumnRef Name="ModelArea" /&gt;
                &lt;ColumnRef Name="ModelVolume" /&gt;
                &lt;ColumnRef Name="ModelWeight" /&gt;
                &lt;ColumnRef Name="Length"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Width"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Thickness"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Height"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Perimeter"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Area"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="area"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Volume"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="volume"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Weight"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="weight"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Count"&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="PrimaryQuantity"&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
            &lt;/Table&gt;
            &lt;Table Name="StepResource"&gt;
                &lt;ColumnRef Name="Length"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Width"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Thickness"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Height"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Perimeter"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Area"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="area"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Volume"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="volume"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Weight"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="weight"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Count" /&gt;
                &lt;ColumnRef Name="PrimaryQuantity" /&gt;
            &lt;/Table&gt;
            &lt;Table Name="ObjectStep"&gt;
                &lt;ColumnRef Name="Object" /&gt;
                &lt;ColumnRef Name="ModelLength" /&gt;
                &lt;ColumnRef Name="ModelWidth" /&gt;
                &lt;ColumnRef Name="ModelThickness" /&gt;
                &lt;ColumnRef Name="ModelHeight" /&gt;
                &lt;ColumnRef Name="ModelPerimeter" /&gt;
                &lt;ColumnRef Name="ModelArea" /&gt;
                &lt;ColumnRef Name="ModelVolume" /&gt;
                &lt;ColumnRef Name="ModelWeight" /&gt;
                &lt;ColumnRef Name="Length"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Width"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Thickness"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Height"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Perimeter"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Area"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="area"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Volume"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="volume"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Weight"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="weight"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
            &lt;/Table&gt;
            &lt;Table Name="Step"&gt;
                &lt;ColumnRef Name="Length"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Width"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Thickness"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Height"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Perimeter"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Area"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Volume"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Weight"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
            &lt;/Table&gt;
            &lt;Table Name="Object"&gt;
                &lt;ColumnRef Name="Object" /&gt;
                &lt;ColumnRef Name="Description1" /&gt;
                &lt;ColumnRef Name="Description2" /&gt;
                &lt;ColumnRef Name="ModelLength" /&gt;
                &lt;ColumnRef Name="ModelWidth" /&gt;
                &lt;ColumnRef Name="ModelThickness" /&gt;
                &lt;ColumnRef Name="ModelHeight" /&gt;
                &lt;ColumnRef Name="ModelPerimeter" /&gt;
                &lt;ColumnRef Name="ModelArea" /&gt;
                &lt;ColumnRef Name="ModelVolume" /&gt;
                &lt;ColumnRef Name="ModelWeight" /&gt;
                &lt;ColumnRef Name="Length"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Width"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Thickness"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Height"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Perimeter"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="length"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Area"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="area"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Volume"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="volume"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Weight"&gt;
                    &lt;Formula varies="1"&gt;&lt;/Formula&gt;
                    &lt;Units varies="1" group="weight"&gt;&lt;/Units&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Count"&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="PrimaryQuantity"&gt;
                    &lt;Purpose&gt;Calculation&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
            &lt;/Table&gt;
            &lt;Table Name="Item"&gt;
                &lt;ColumnRef Name="Length"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Width"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Thickness"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Height"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Perimeter"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Area"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Volume"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Weight"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Count"&gt;
                    &lt;Formula varies="1"&gt;=1&lt;/Formula&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="PrimaryQuantity" /&gt;
            &lt;/Table&gt;
            &lt;Table Name="ItemGroup" /&gt;
            &lt;Table Name="Resource"&gt;
                &lt;ColumnRef Name="Length"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Width"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Thickness"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Height"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Perimeter"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Area"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Volume"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Weight"&gt;
                    &lt;Purpose&gt;RollUp&lt;/Purpose&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="Count"&gt;
                    &lt;Formula varies="1"&gt;=1&lt;/Formula&gt;
                &lt;/ColumnRef&gt;
                &lt;ColumnRef Name="PrimaryQuantity" /&gt;
            &lt;/Table&gt;
            &lt;Table Name="ResourceGroup" /&gt;
        &lt;/Workbook&gt;
    &lt;/ConfigFile&gt;
&lt;/Takeoff&gt;
</code></pre>

<hr>

<p>Part of the result so far</p>

<pre><code>&lt;ns0:Takeoff xmlns="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://download.autodesk.com/us/navisworks/schemas/nw-TakeoffCatalog-10.0.xsd"&gt;
        &lt;ns0:Catalog&gt;
            &lt;ns0:Item CatalogId="f9f30bfc-6c43-4b7b-a335-5c5c093b4165" Color="-3887691" LineThickness="0.1" Name="Column Location D" Transparency="0.3" WBS="1"&gt;
                &lt;ns0:VariableCollection&gt;
                    &lt;ns0:Variable Formula="=ModelLength" Name="Length" Units="Meter" /&gt;
                    &lt;ns0:Variable Formula="=ModelWidth" Name="Width" Units="Meter" /&gt;
                    &lt;ns0:Variable Formula="=ModelThickness" Name="Thickness" Units="Meter" /&gt;
                    &lt;ns0:Variable Formula="=ModelHeight" Name="Height" Units="Meter" /&gt;
                    &lt;ns0:Variable Formula="=ModelPerimeter" Name="Perimeter" Units="Meter" /&gt;
                    &lt;ns0:Variable Formula="=ModelArea" Name="Area" Units="SquareMeter" /&gt;
                    &lt;ns0:Variable Formula="=ModelVolume" Name="Volume" Units="CubicMeter" /&gt;
                    &lt;ns0:Variable Formula="=ModelWeight" Name="Weight" Units="Kilogram" /&gt;
                    &lt;ns0:Variable Formula="=1" Name="Count" /&gt;
                &lt;/ns0:VariableCollection&gt;
            &lt;/ns0:Item&gt;
        &lt;/ns0:Catalog&gt;
        &lt;ns0:ConfigFile&gt;
            &lt;Workbook noNamespaceSchemaLocation="http://download.autodesk.com/us/navisworks/schemas/nw-TakeoffConfiguration-10.0.xsd"&gt;
&lt;/Workbook&gt;
    &lt;/ns0:ConfigFile&gt;
&lt;/ns0:Takeoff&gt;
</code></pre>

<p>I understand the problem now, you have unwanted ns0 prefixes in your output. In order to avoid them you may need to register all the namespaces with their corresponding prefixes:</p>

<pre><code>etree.register_namespace("xs","http://www.w3.org/2001/XMLSchema")
etree.register_namespace("xsi","http://www.w3.org/2001/XMLSchema-instance")
etree.register_namespace("","http://download.autodesk.com/us/navisworks/schemas/nw-TakeoffCatalog-10.0.xsd")
</code></pre>

python xml elementtree