On the morning of 6/28 I want to catch a flight from Hong kong to beijing.
As Hong Kong - Beijing is an international flight, I would suggest you to take a flight from Shenzhen to Beijing if you wanna save some money.
I would arrive in Xi'an on the morning of 7/2 and spend the day and night there. (i'm mainly interested in seeing the warriors -since the train gets in early morning is it possible to see the warriors and then catch a flight to guilin in the evening and spend the night there before moving on to Yanhshuo?)
It is possible but the warriors are outside of the city like the airport so you maybe would be in a hurry.
On 7/8 I would fly back to hong kong and spend the night there.
As I mention above, to fly to Hong Kong is an international flight. To fly to Shenzhen, stay the night there (for cheaper money) is an alternative.
I'll spend the night in Xi'an so I don't feel the need to rush to the airport. The suggestion of looking at Shenzhen to Beijing flight is one that I will do. Coming back from Shanghai though it might be worth it to fly straight to hong kong airport. The alternative is I can fly shanghai to Shenzhen and cross the border the day before and stay in hong kong. I have a free hyatt night, so lodging cost would not be an issue in hong kong and therefore no need to stay in Shenzhen (unless its worth staying in for sightseeing reasons).