今天遇到了这个错误:org.xml.sax.SAXParseException: The value of attribute "value" associated with an element type "property" must not contain the '<' character.
折腾了大半天!
排除了编码问题,如果xml文件是utf-8编码但带BOM 的话,就会有这样的错误:
Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.
那么我确定xml编码没问题后,仍然出现org.xml.sax.SAXParseException: The value of attribute "value" associated with an element type "property" must not contain the '<' character. 这是什么原因呢??? 仔细检查配置文件,没有“<”这样的特殊字符啊。后来才想起来,配置文件中的数据库里的用户名和密码是加密过后的,加密过后的密码确实没有“<”,可是密码原文坑爹的就是带有 “<”字符的啊!!!
那么,在加密之前,数据库密码中的特殊字符就应该先转义下,再加密,替换了下加密字符。问题解决了。
万恶的 xml 文件就应该被淘汰吧。。。