Analytical expressions are derived for both the pi and sigma* resonan
ces in near-edge x-ray-absorption finestructure (NEXAFS) spectra from
diatomic molecules. A simple criterion is formulated for extracting st
ructural parameters (e.g., the bond lengths) of such molecules from NE
XAFS spectra. A universal curve for the positions of resonances is der
ived from our analytical expressions. The predictions are confirmed by
comparisons with computer simulations of NEXAFS spectra for gas-phase
N-2 and O-2 molecules.