PLGAJS-93 Avoid infinite loop is selection is not a valid XML