Effects of rare-earth substitution in the oxyarsenides REFeAsO (RE=Ce, Pr, Nd, Sm, Gd) and CeNiAsO by X-ray photoelectron and absorption spectroscopy