Rare-earth valence in the high-Tc and related oxides studied by photoelectron and X-ray absorption spectroscopies