for record ( list of records ) do create xml file with 1 record of data validate the above xml file if validated then push record to success file else push record to failure file fi done use success file to generate final xml file