The analysis of x-ray absorption spectra to determine the electronic and magnetic structure of transition metal compounds is discussed. The models to describe the ground state of transition metal compounds (single-particle, impurity, crystal field) are introduced. Some basic aspects of the interaction of x-rays with matter are recapitulated and the description of x-ray absorption is separated into single-particle models for the 1s edges and multiplet models for the 2p edges. Magnetic circular dichroism is introduced and the six Thole sum rules are discussed. The complications and experimental problems of the sum rules are outlined. The last section briefly mentions some aspects of resonance studies, for which a detailed knowledge of x-ray absorption is crucial.