I'm puzzled by this question.
C2 offers JSON as "export" data format, but not XML.
In the absolute though, you could build your own XML file out of an array, but you have to implement it all in order to do so.
You have to first check the array's dimensions to determine whether it is a one, two or three dimension(s) array.
You have then go through each X, Y and Z of the array as required, and save tags/values for each cell.
You can save all this in a text variable and display it in a TextBox.
Unfortunately, I doubt you will be able to offer it for download, like a JSON file since this action (Download XML) is not available.