removed some duplicate code from xml file formatter