China should not prevent elected officials from taking office. When people vote for a candidate, they want that person to speak on their behalf. When the government will not let who the people voted for get into the office, the people have not voice and the government is in complete control and that is not something that should happen.
If the majority of people in any given country vote someone into office then they have the right to take that office. A good Example of that is today in the US Donald Trump was elected President. Half the country doesn't agree with the outcome but we still have to respect the vote.
I don't think China has the right to prevent legally elected officials from taking office. The sincere, accurate and solemn test for evaluating their oath taking doesn't sound quite above board , and reads more like an attempt to prevent pro-independence members from being able to participate in the government.
The drastic action to bar the two democratically elected officials for what many considered to be a childish matter has prompted fears in Hong Kong that further attempts at autonomy will be severely punished. At the heart of the debate is the "one country, two systems" model, under which Hong Kong is supposed to maintain a degree of autonomy within China. Hong Kong has a separate economic and political system — including, normally, its own courts, which were bypassed in this instance.