A love-hate relationship
As China's economic, political and military influence rises, one important question is - what sort of power China will be? How will it interact with foreigners and foreign nations?
Will it be benign - as China's own officials say when they talk of China's "peaceful rise" - or will it be an assertive, nationalistic, even xenophobic power?
In recent days, we've seen two very different Chinas on show when it comes to interacting with foreigners here, inside its borders.
In the media, and particularly on the internet, a hostile, anti-foreigner China has clearly been on view, but so too has a much warmer, more generous view of outsiders.
The hostility has been fed by a whole series of events.
The decision by American diplomats to give shelter to the blind Chen Guangcheng has been criticised as "interference", and the dispute with the Philippines over islands in the South China Sea has drawn lots of angry comment.
Most provocative of all have been a couple of videos posted on the internet. First came one on Youku, China's version of YouTube, showing a foreigner apparently trying to sexually assault a woman on a busy Beijing street.
The footage is disturbing but edited, so parts of what follows are not clear. Passers-by intervene. The man ends up seemingly unconscious in the middle of a busy road, a police car there, being protected by one man while another continues to try to kick him in a rage.
More photos of the same man apparently harassing women on Beijing's underground train network were posted on China's microblogs. Beijing police announced that he was British man and is now under arrest.
The second video showed a Russian man on a train from Shenyang to Beijing. He puts his feet on the seat in front and then hurls abuse at the Chinese woman sitting there when she complained.
Chinese internet users identified him as Oleg Vedernikov, a cellist employed by the Beijing Symphony Orchestra. He apologised on the orchestra's website, but has now been sacked.
Then, on 14 May, the police announced a 100-day "strike-hard" campaign to "clean out" foreigners living or working illegally in the city. The police asked people to inform on any foreigner they had suspicions about.
Into this already febrile atmosphere waded Yang Rui, one of the highest-profile anchors on Chinese state television. He hosts a discussion show in English called "Dialogue" on CCTV 9. The show features foreign guests and the channel is meant to spearhead China's attempts to develop "soft-power" by competing with CNN, the BBC and others.
Mr Yang posted a vitriolic message on China's equivalent of Twitter supporting the police crackdown "to clean out the foreign trash. People who can't find jobs in the US and Europe and come to China to grab our money."
He attacked foreigners with Chinese girlfriends, saying: "Foreign spies find Chinese girls and live with them, posing as a tourists, while collecting intelligence and GPS data."
He also praised China's decision last month to expel the Al-Jazeera English journalist Melissa Chan, saying "we kicked out that foreign bitch. We should shut up and kick out all those who demonise China."
But he also drew support. The China Youth Daily newspaper said that "foreigners have become spoiled by special treatment in China".
The Global Times newspaper says the comments "expressed his personal view and feelings and had nothing to do with his job", so Yang "was insensitive, but shouldn't be sacked".
The paper adds that "the crackdown on illegal immigrants has nothing to do with anti-foreigner sentiments. The Chinese public generally holds a kind and friendly view towards foreigners".
'French Fry Brother'
That different view has also been in evidence. An American student became an internet sensation earlier this month when he was photographed sitting on the pavement talking with an elderly beggar in Nanjing.
He had bought her some fast food to eat, and became known to internet users as "French Fry Brother". One hundred fifty thousand comments were posted on the web about him.
A Brazilian was also widely praised for trying to help a woman who was being mugged. The thieves beat him up as a couple of dozen people looked on and did nothing to intervene.
The events sparked a lot of comment about how generous foreigners could be, what the Chinese could learn from them, and whether modern China is becoming a soulless place.
These two, conflicting attitudes to foreigners - hostility and admiration - coexist in China today.
What the past few weeks have demonstrated is how one or two seemingly random or isolated events can mean the more nationalistic tone, which bubbles under the surface, breaks through and then gets picked up and amplified on the web and the media.
Both attitudes are there on a special page on the Sina website titled "Beijing welcomes you decent foreigners". But the more nationalistic side features first. You have to scroll down to the bottom to find the section about the "decent foreigners".