X-ray absorption and photoelectron spectroscopy studies on graphite and single-walled carbon nanotubes: Oxygen effect