Added method to convert array to XML