X-ray absorption near-edge structure of metal hydrides