It really isn't that uncommon that it is possible for at least some people to work out who a rape victim is. Look at the many instances of rape of spouses/partners, for instance.
It would also be near-impossible to report on the trial whilst completely concealing the link. As soon as it became obvious that facts were being suppressed, people would put two and two together and would work out that the victim must have some sort of connection to the accused.. The only way to avoid it would be to prevent any reporting whatsoever at the trial, but even then it's inevitable that it would come out that the MP had suddenly resigned/been sacked and had subsequently gone to prison - and people would work out that it must have been a sexual offence due to the reporting ban. There is also the issue that secret justice is inherently dangerous anyway.
So I don't think you can necessarily blame the press. It's just a dreadful fact that, if you are raped by a famous man, there is a good chance that your anonymity won't be fully preserved. It's one of the reasons that famous men get away with it. I wish I knew the answer.