It can be a simple bacterial infection of the gut or a worm infestation or food allergy
Consult your pediatrician
and get your sons stool tested for worms and a bacterial culture done. Based on the results he can be treated with positive outcome with antibiotic or antihelminthics or antiparasitic
Try to find if is there specific food stuff or chocolate which is causing the child to vomit and purge, if yes just stop it.
Is he nervous while going to school? just talk to him and try to know.