I have been to China and I would recommend spending about 3 weeks in the country at least (but if short on time 3 weeks is enough). Here are the places I would recommend that you visit during your trip (in order):
Beijing: I would certainly recommend visiting Beijing for sights such as the Great Wall, the Lama Temple, The Temple of Heavenly Peace, the Birds-Nest Stadium, Tiananmen Square and the Forbidden City.
Xian: The main sight here is the Terracotta Army which is worth a visit - it is even more spectacular in real life and I wouldn't miss Xian out for this reason.
Chengdu: This is where you can visit the Giant Pandas, visit Le Shan Buddha (the biggest in the world) and also get a Sichuan cooking class.
Guilin/Yangshuo: Head to Guilin by train or plane to visit Yangshuo (about 2 hours away). This is the place I would NOT miss out of any China itinerary. Yangshuo is spectacular, with a stunning backdrop of Karst mountains and the highlight of a trip here is taking in the beautiful scenery on a bamboo rafting trip. Spend at least 5 days here, longer if you can!
Hong Kong/Shanghai: I would then finish my trip in either Hong-Kong or Shanghai for an airport.
I hope this helps!