X-ray absorption spectroscopy study of Mg-bearing minerals