Commit 84cb6d6e authored by Jonathan Klimt's avatar Jonathan Klimt Committed by Jan Dinkelbach
Browse files

Reset xml input before running iterparse on it

parent 2bac4959
Pipeline #330774 passed with stages
in 1 minute and 32 seconds
......@@ -94,6 +94,10 @@ def _instantiate_classes(import_result, xml_files, cgmes_version_path, namespace'START of parsing file \"%s\"', xml_file)
# Reset stream
if hasattr(xml_file, "seek"):
# get an iterable
context = etree.iterparse(xml_file, ("start", "end"))
......@@ -195,6 +199,10 @@ def _set_attributes(import_result, xml_files, namespace_rdf, base, logger_groupe
# get an iterable and turn it into an iterator (required for cElementTree).
context = iter(etree.iterparse(xml_file, ("start", "end")))
# Reset stream
if hasattr(xml_file, "seek"):
# Get the root element ({}RDF).
_, root = next(context)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment