@@ -820,13 +820,12 @@ def _data(self) -> Mapping[int, XmfEntry]:
820820 coord_filepattern = "_" .join (coord_file_chunks )
821821
822822 fields_info = {}
823- while xs .current .tag == "Attribute" :
824- with xs .load () as elt_fvar :
825- name = elt_fvar .attrib ["Name" ]
826- elt_data = elt_fvar [0 ]
827- shape = self ._get_dims (elt_data )
828- ifile , isnap = _ifile_isnap (xs .filepath , elt_data )
829- fields_info [name ] = (ifile , shape )
823+ for elt_fvar in xs .iter_load_successive_tag ("Attribute" ):
824+ name = elt_fvar .attrib ["Name" ]
825+ elt_data = elt_fvar [0 ]
826+ shape = self ._get_dims (elt_data )
827+ ifile , isnap = _ifile_isnap (xs .filepath , elt_data )
828+ fields_info [name ] = (ifile , shape )
830829
831830 r_yin , r_yang = _count_subdomains (xs , i0_yin )
832831
@@ -1120,11 +1119,10 @@ def _data(self) -> Mapping[int, XmfTracersEntry]:
11201119 ifile , isnap = _ifile_isnap (xs .filepath , data_item )
11211120 fields_info [name ] = ifile
11221121
1123- while xs .current .tag == "Attribute" :
1124- with xs .load () as elt_fvar :
1125- name = elt_fvar .attrib ["Name" ]
1126- ifile , _ = _ifile_isnap (xs .filepath , elt_fvar [0 ])
1127- fields_info [name ] = ifile
1122+ for elt_fvar in xs .iter_load_successive_tag ("Attribute" ):
1123+ name = elt_fvar .attrib ["Name" ]
1124+ ifile , _ = _ifile_isnap (xs .filepath , elt_fvar [0 ])
1125+ fields_info [name ] = ifile
11281126
11291127 r_yin , r_yang = _count_subdomains (xs , i0_yin )
11301128
0 commit comments