Awfully crammed in and Xi'an has so much more to offer than the Warriors. A quick check of the official Railways website shows the Z92 train as still having regular soft sleepers and deluxe soft sleepers for the 18th. Train departs Shanghai (main) station at 18:55, arrives Xi'an main station at 09:16...you'd have to cut your Tuesday plan a bit short. I'd tend to do that and if you can afford the deluxe soft (private 2-berth compartment with private washroom) go for it--you'll be saving a hotel night anyway. But you must grab these tickets asap.
You'd have time on the 19th to see the Warriors then Muslim Quarter in the late afternoon and early evening. Hotel that night in Xi'an. Bullet train to Beijing on the morning of the 20th. The morning G trains Xi'an-Beijing all have availability in both 1st and 2nd class right now, but you might want to get these tickets also when in Shanghai to save time later. You need not go to a station to buy, just a remote ticket office close to your hotel. Or maybe your hotel will purchase for you for a surcharge.
I would train from Xi'an to Beijing for both convenience and reliability. When you add up the time it takes to get from central cities to and from airport on each end, plus the check-in, security, boarding sequence and flight time itself, you won't be saving any time by flying and you'd be subject to delay or other IRROPS. Train is also more comfortable since there is more room and you can roam around. And the bathrooms are better.