Array to XML function