Hey,
I'm American but I lived in Shanghai for 6 years. I'll kinda give you a run of the cities you're going to. However, I only went to Xi'an once so I can't really give a huge rundown on that.
Beijing: I've been there several times so I can give a decent rundown of the city. In terms of places to go, I recommend that you visit the Great Wall (specifically the JiaYuGuan section of the wall. Avoid the sections close by to the city as they are swarming with tourists), TianAnMen Square and the Forbidden City. The 2008 Olympic site is really neat too, but that would only be a short visit. There's is never a problem with just getting dropped off somewhere in the city and wandering around. If you've never been there, it's really quite interesting. As far as food goes, there are night markets scattered around the city that are really cheap but the food is delicious. I also recommend trying the Peking Duck. You can find a restaurant online I'm sure. However, be sure to make a reservation. There are also many local sort of "hole in the wall" restaurants that sell noodles and local delicacies.
Xi'an: Honestly, I went there once and I didn't really enjoy it. I can't see spending more than 2 days there. The Terra Cotta warriors are definitely
interesting but they get old kinda fast. There's also a surrounding wall in the city that you can bike or walk. Other than that, I don't know much about the cities.
Shanghai: This is where the bulk of my info comes in. I'll start with sites to see. I recommend going to the financial district and seeing the Pearl Tower, the World Financial Center and there's a 3rd tower which name slips my mind. Nearby is a district called JinQiao, which is essentially the foreigner's district, and the Science and Tech Museum. Under the S&T Museum is where you will definitely want to go. It's called KeJiGuan. It's a place to buy fashion and silks. More importantly, it's a great place to buy fake goods. Headphones, games, and everything technological. What I just mentioned is in the side of the city called PuDong. On the opposite side, PuXi, is where more of the interesting stuff is. There is a place called the Yu Gardens, which is a modernized temple area. There is also the Jing'an temple, but that's sort of a tourist trap. There is also an area called People's Square. Around it are malls. Inside is a park and the Shanghai Museum. Nearby is JingLi Road. It's a famous street known for the musical instruments you can buy there. In terms of food in Shanghai, the hole in the wall restaurants that are literally everywhere are always great. Famous things include a dumpling restaurant in the Yu Gardens (you'll notice a huge line in Yu Gardens of people waiting for food, hard to miss but you should make a reservation). Once again, just wandering the city is a
great thing to do.
That's about it from me. However, find stuff for yourself to do there. May I ask how well you speak Mandarin?