Added function to convert results to XML