It's not the attacking that's ruining McCain. It's the way he is attacking. McCain's greatest strength was his independent streak. That's what got him so much indy support, as opposed to the party's right-wing (can't even call them conservative) religious base. McCain has had to cozy up to them because, well, he's a republican.
The problem is that they've now got so big a say in the campaign that it looks like, to them, it's Palin on the top of the ticket and the only purpose for McCain is to get her in office. McCain can (well, could have) win but it's Palin they really want. Unfortunately, embracing Palin and letting this small faction of the party have so much power has chased away the independents. The neocons have practically swallowed up McCain. I actually feel really bad for him because it looks like his misplaced loyalty to the Republican party will cost him his dream. And he wasn't half bad. But he stuck with this party even long after they made it clear that they were moving away from his practical conservatism, and even after they'd already stabbed him in the back once. He stuck with them for purposes of his own ambition, and so I guess it all comes out in the wash. It would make a good comedic tragedy.