simplify and avoid repetition in ParserHelper methods
Simplify and avoid repetition in ParserHelper methods and tests in ExtraInfoDescriptorTest accordingly. Cf. #22217 (moved) comments 6 an 7. This includes a minor code clean-up and raising exceptions when duplicate keys are encountered.