I have the following python code:
from xml.etree import ElementTree as et
from optparse import OptionParser
import ConfigParser
import fileinput, sys
import os
config_file = 'ClientConfig.xml'
tree = et.parse(config_file)
root = tree.getroot()
for element in root.findall("/client/config/TEST_CLIENT"):
for elem in element.iter(tag='Item'):
print elem.tag, elem.attrib
Is there a way for me to print the xpath directly for each element as opposed to rebuilding it using the elem.tag and elem.attrib options? That is, I want to be able to print each elements full xpath