If China does invade the DPRK, I don't think it would be hard for them to get out. It would probably be a similar scenario to the Soviet military interventions in Hungary and Czechoslovakia. The Chinese forces enter, sweep aside resistance, remove the leader they are unhappy with and replace him with one who will obey China. If the PLA were to invade, overcoming resistance would be an easy job. As mentioned earlier, North Korean troops are more concentrated on the DMZ, not the Yalu river. And since the KPA is inferior to the PLA in terms of equipment, fuel and training (NK soldiers can't be that well trained, most of them are conscripts), they would be no match. The PLAAF could simply crush the North Koreans with heavy air strikes and bombing. Its unknown just how dedicated North korean soldiers and civillians are (note that there have been major defections from the North Korean armed forces) so its hard to say whether China would face a guerilla war or not. But it seems unlikely, given the famine striken conditions in North Korea due to misnagement. Then the PLA (possibly SOF) enter Pyongyang and remove Kin Jong Il (shoot him, exile him or whatever) and replace him with someone who will be loyal to China and will thereby be prepared to intiate Chinese-style reform, and if China wishes, dismantle the nuclear programme. After that, China can withdraw, unless the locals rise up and wage a guerilla war on the PLA and new KPA forces. That would mean a much longer stay for Chinese troops.
Of course, there is the possibilty that Kim Jing Il could use what WMD he has on his former ally. He has plenty of missiles that can reach China. The best way for China to overcome this would be to either launch a systematic bombing campaign to destroy North Korean missile stocks, or to advance rapidly in Blitzkreig fashion to capture the weapons facilties and other key targets, and overcome the enemy before he can use his weapons. The latter would be the best option, since it would take North Korea by surprise, and capture Kim Jong Il before he can do any damage (They could force him to make a broadcast announcing his resignation, as well as a call to surrendur all WMD). That would require skillful and pre-meditated planning, and would possibly involve special forces destroying the North Korean command structure and weapons sites during the advance. The fact that not many NK troops are stationed on the Chinese border would make a Chinese blitzkreig possible (perhaps the PLA is already planning a possible offensive). Such an offensive would also require large number of tanks, as well as heavy artillery or close air suppourt to suppourt the advance. China pretty much has this, although it would probably be quite weak in close air suppourt, since they don't have reliable helicpoter gunships or armoured strike planes yet. But I think they are capable of doing it, since they've probably learned lessons from the 1979 Sino-Vietnam war. It would give the modernised PLA a chance to prove itself, so it would be good for the military.