Electronic structure of pristine and Ni-substituted from near edge x-ray absorption fine structure experiments and first-principles simulations