An integrated theoretical approach based on a discrete-continuum solvent model combined with molecular dynamics and time-dependent density functional theory leads to near-edge x-ray and optical absorption spectra of liquid water in excellent agreement with experiments. For quantitative results both self-interaction and long-range effects should be properly corrected. While scaling with respect to a monomer effectively compensates the self-interaction error, long-range effects require inclusion of exact exchange. Further, new physical insights on the not fully elucidated nature of the first optical band are provided.