I have a python script that is reading in an xml file using lxml. However lxml is getting thrown off by the namespace. Ie if delete xmlns="http://theurl.com"
from my xml file before running the script it works fine and finds all the elements.
I am really struggling on how to modify the script to make it so I dont need to delete the name space reference from the xml file before parsing.
Sample Code
from lxml import etree
root = etree.parse(r'myfile.xml')
Elements=[]
for elements in root.xpath('//element'):
print(list(elements.keys()))
Sample File.
<ServiceDefinition xmlns="http://theurl.com" " version="1.0.1.0">
<schema>
<seqtype="xyz">
<element name="element 1"/>
<element name="element 2"/>
</seqtype>
</schema>
</ServiceDefinition>