The x-ray absorption near-edge structure of graphene, graphene oxide, and diamond is studied by the recently developed real-space full potential multiple scattering (FPMS) theory with space-filling cells. It is shown how accurate potentials for FPMS can be generated from self-consistent charge densities obtained with other schemes, especially the projector augmented wave method. Compared to standard multiple scattering calculations in the muffin-tin approximation, FPMS gives much better agreement with experiment. The effects of various structural modifications on the graphene spectra are well reproduced. (1) Stacking of graphene layers increases the peak intensity in the higher energy region. (2) The spectrum of the C atom located at the edge of a graphene sheet shows a prominent pre-edge structure. (3) Adsorption of oxygen gives rise to the so-called interlayer-state peak. Moreover, O K-edge spectra of graphene oxide are calculated for three types of bonding, C-OH, C-O-C, and C-O, and the proportions of these bondings at 800 degrees C are deduced by fitting them to the experimental spectrum.