It is not clear why you are assuming that ```fname``` should end with ```.xml```.