Prior to this commit, Spring failed to determine that an XML config file was DTD-based if the DTD declaration was followed by a comment. This commit fixes this by modifying the consumeCommentTokens(String) algorithm in XmlValidationModeDetector so that both leading and trailing comments are properly consumed without losing any XML content. Closes gh-23605