I can't seem to figure out how to get cElementTree to recurse into xml import elements. I presume I'm missing something simple here.
<import file="xmlfile_imported.xml"/>
code I'm using
try:
import cElementTree as ET
except ImportError:
try:
# Python 2.5 need to import a different module
import xml.etree.cElementTree as ET
except ImportError:
exit_err("Failed to import cElementTree from any known place")
def_file="xmlfile.xml"
try:
tree = ET.parse(open(def_file, "r"))
root = tree.getroot()
except:
exit_err("Unable to open and parse input definition file: " + def_file)
for child in root:
print(child.tag, child.attrib);
Using this code I will only see the content of the xmlfile.xml but not the content of xmlfile_imported.xml.
what am I doing wrong here?
No comments:
Post a Comment