Police have now confirmed that they have taken a suspect into custody, a man with the surname of Zhao who is 28 years old. Some showed bodies along alleyways and other injured people calling for help.
The attacker had been bullied at school and harboured a hatred of children, the report by state broadcaster CCTV said.
The knife-wielding man attacked students near a secondary school in the Shaanxi province as they were heading home for the day.
Shocking videos and images were posted online. The dead were 5 girls, 2 boys, and the number of injured children made up 12. "Hurry up, hurry up, call for help!" a woman shouted in one video. Police said five girls and two boys were killed in the attack.
At least seven students have been stabbed to death in a knife attack outside a school in northern China, officials say.
The suspect was apparently seeking revenge for having been picked on, the Mizhi government's official microblog said on Saturday. Another user said it was necessary to take steps to stop more attacks. Law enforcement authorities of China are going to test the psychological sanity of the killer. While violent crime is rare in China, attacks have persisted.