Chitosan microspheres as a template for TiO2 and ZnO microparticles: studies on mechanism, functionalization and applications in photocatalysis and H2S removal