Singularities in the X-Ray Absorption and Emission of Metals. II. Self-Consistent Treatment of Divergences