File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,16 +181,26 @@ def read(self) -> MessageImplementationGuide:
181181 read the entire file and convert it to a MessageImplementationGuid instance
182182 """
183183 segments_and_groups = []
184+ root_gathering = []
184185 root = self ._element_tree .getroot ()
185186 if _is_uebertragungsdatei (root ):
186187 for elem in root .iter ():
188+ if elem .tag .startswith ("S_UNA" ) | elem .tag .startswith ("S_UNB" ):
189+ root_gathering .append (elem )
187190 if elem .tag .startswith ("M_" ):
188- root = elem
191+ root_gathering . append ( elem )
189192 break
190- for index , element in enumerate (root ):
191- if index == 0 :
193+ for sinlge_root in root_gathering :
194+ if sinlge_root .tag .startswith ("M_" ):
195+ for index , element in enumerate (sinlge_root ):
196+ if index == 0 :
197+ if not element .tag .startswith ("S_UNH" ):
198+ continue
199+ segments_and_groups .extend (self ._iter_segments_and_segment_groups (element ))
200+ if sinlge_root .tag .startswith ("S_UNA" ) | sinlge_root .tag .startswith ("S_UNB" ):
201+ segments_and_groups .extend (self ._iter_segments_and_segment_groups (sinlge_root ))
202+ else :
192203 continue
193- segments_and_groups .extend (self ._iter_segments_and_segment_groups (element ))
194204
195205 result = MessageImplementationGuide (
196206 veroeffentlichungsdatum = self .get_publishing_date (),
You can’t perform that action at this time.
0 commit comments