Twenty pupils at a Beijing primary school were wounded on Tuesday in a hammer attack that police said left three seriously injured, state news agency Xinhua reported.