In this thesis, the magnetism of ultrathin ferromagnetic films of Fe, Co, and Ni as well as the magnetism of single crystals of the rare earth elements Gd, Tb, and Dy have been studied by means of X-ray absorption spectroscopy. To support measurements even in an applied magnetic field, a new water-c...