Reaction Mechanisms in Advanced Materials for Li and Na-ion Batteries Studied by X-ray Absorption Spectroscopy and Related Techniques