  X-ray absorption spectroscopy (XAS) is widely employed for structure
characterization of graphitic carbon nitride (g-C$_3$N$_4$) and its composites.
Nevertheless, even for pure g-C$_3$N$_4$, discrepancies in energy and profile
exist across different experiments, which can be attributed to variations in
structures arising from diverse synthesis conditions and calibration
procedures. Here, we conducted a theoretical investigation on XAS of three
representative g-C$_3$N$_4$ structures (planar, corrugated, and
micro-corrugated) optimized with different strategies, to understand the
structure-spectroscopy relation. Different methods were compared, including
density functional theory (DFT) with the full (FCH) or equivalent (ECH)
core-hole approximation, as well as the time-dependent DFT (TDDFT). FCH was
responsible for getting accurate absolute absorption energy; while ECH and
TDDFT aided in interpreting the spectra, through ECH-state canonical molecular
orbitals (ECH-CMOs) and natural transition orbitals (NTOs), respectively. With
each method, the spectra at the three structures show evident differences,
which can be correlated to different individual experiments or in between. Our
calculations explained the structural reason behind the spectral discrepancies
among different experiments. Moreover, profiles predicted by these methods also
displayed consistency, so their differences can be used as a reliable indicator
of their accuracy. Both ECH-CMOs and NTO particle orbitals led to similar
graphics, validating their applicability in interpreting the transitions. This
work provides a comprehensive analysis of the structure-XAS relation for
g-C$_3$N$_4$, provides concrete explanations for the spectral differences
reported in various experiments, and offers insight for future structure
dynamical and transient X-ray spectral analyses.
