Structure-Preserving Physics-Informed Neural Network for the Korteweg--de Vries (KdV) Equation