Preparation of carboxylic acids or their salts, halides or anhydrides by oxidation with oxides of nitrogen or nitrogen-containing mineral acids