Closed ksauzz closed 3 years ago
Pushed the fix for missing text in attribute element because I only used start
event.
see: https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.iterparse
Note iterparse() only guarantees that it has seen the “>” character of a starting tag when it emits a “start” event, so the attributes are defined, but the contents of the text and tail attributes are undefined at that point. The same applies to the element children; they may or may not be present. If you need a fully populated element, look for “end” events instead.
Thanks!!
Issue Summary
read_network doesn't return correct link_attrs. It seems all link_ids are shifted.
How to reproduce
Test Data: network.xml
Tried to read attributes from the network.xml, but they are shifted.
Resolution
start
andend
events forxml.etree.ElementTree.iterparse
link_id
atstart
event since attribute needs it before</link>
attribute
element atend
event with correctlink_id
xml.etree.ElementTree.Element.clear()
only afterend
event oflink
andnode
, to keep text and children of them afterstart
event._I ran testMatsimNetworkReader.py only since I'm not sure how to prepare the test environment for this project properly.