Added logic for producing an xml file as output, finished subroutine.