X-ray Absorption Spectroscopy of Transition Metal and Lanthanide Magnetic Molecules