fixed xml loader so that it should be "finished"

obvious refactoring is needed, I also added a new exception class
(CriticalErrorException, change the name if you feel like it)  this
exception is one of those that should never actually be thrown (it being
thrown means something really bad happened)