Output to XML function