@@ -162,18 +162,19 @@ def insert(self, index, cube):
162162
163163 def xml (self , checksum = False , order = True , byteorder = True ):
164164 """Return a string of the XML that this list of cubes represents."""
165- doc = Document ()
166- cubes_xml_element = doc .createElement ("cubes" )
167- cubes_xml_element .setAttribute ("xmlns" , XML_NAMESPACE_URI )
168-
169- for cube_obj in self :
170- cubes_xml_element .appendChild (
171- cube_obj ._xml_element (
172- doc , checksum = checksum , order = order , byteorder = byteorder
165+ with np .printoptions (legacy = "2.2" ):
166+ doc = Document ()
167+ cubes_xml_element = doc .createElement ("cubes" )
168+ cubes_xml_element .setAttribute ("xmlns" , XML_NAMESPACE_URI )
169+
170+ for cube_obj in self :
171+ cubes_xml_element .appendChild (
172+ cube_obj ._xml_element (
173+ doc , checksum = checksum , order = order , byteorder = byteorder
174+ )
173175 )
174- )
175176
176- doc .appendChild (cubes_xml_element )
177+ doc .appendChild (cubes_xml_element )
177178
178179 # return our newly created XML string
179180 doc = Cube ._sort_xml_attrs (doc )
@@ -3864,17 +3865,18 @@ def xml(
38643865 byteorder : bool = True ,
38653866 ) -> str :
38663867 """Return a fully valid CubeML string representation of the Cube."""
3867- doc = Document ()
3868+ with np .printoptions (legacy = "2.2" ):
3869+ doc = Document ()
38683870
3869- cube_xml_element = self ._xml_element (
3870- doc , checksum = checksum , order = order , byteorder = byteorder
3871- )
3872- cube_xml_element .setAttribute ("xmlns" , XML_NAMESPACE_URI )
3873- doc .appendChild (cube_xml_element )
3871+ cube_xml_element = self ._xml_element (
3872+ doc , checksum = checksum , order = order , byteorder = byteorder
3873+ )
3874+ cube_xml_element .setAttribute ("xmlns" , XML_NAMESPACE_URI )
3875+ doc .appendChild (cube_xml_element )
38743876
3875- # Print our newly created XML
3876- doc = self ._sort_xml_attrs (doc )
3877- return iris .util ._print_xml (doc )
3877+ # Print our newly created XML
3878+ doc = self ._sort_xml_attrs (doc )
3879+ return iris .util ._print_xml (doc )
38783880
38793881 def _xml_element (self , doc , checksum = False , order = True , byteorder = True ):
38803882 cube_xml_element = doc .createElement ("cube" )
0 commit comments