Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
CIM
CIMpy
Commits
84cb6d6e
Commit
84cb6d6e
authored
Sep 09, 2020
by
Jonathan Klimt
Committed by
Jan Dinkelbach
Sep 14, 2020
Browse files
Reset xml input before running iterparse on it
parent
2bac4959
Pipeline
#330774
passed with stages
in 1 minute and 32 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
cimpy/cimimport.py
View file @
84cb6d6e
...
...
@@ -94,6 +94,10 @@ def _instantiate_classes(import_result, xml_files, cgmes_version_path, namespace
logger
.
info
(
'START of parsing file
\"
%s
\"
'
,
xml_file
)
# Reset stream
if
hasattr
(
xml_file
,
"seek"
):
xml_file
.
seek
(
0
)
# 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"
):
xml_file
.
seek
(
0
)
# Get the root element ({http://www.w3.org/1999/02/22-rdf-syntax-ns#}RDF).
_
,
root
=
next
(
context
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment