The L-level X-ray absorption spectra of atomic barium and mercury