Added more robust credentials xml parsing