Near-edge x-ray absoprtion spectroscopy