Preparation of carboxylic acids or their salts, halides or anhydrides by oxidation with molecular oxygen of oxygen-containing groups to carboxyl groups of —CHO groups or primary alcohol groups