此错误是由 Woodstox XML 解析器引发的。该类的源代码如下所示:InputBootstrapper
protected void reportUnexpectedChar(int i, String msg)
throws WstxException
{
char c = (char) i;
String excMsg;
// WTF? JDK thinks null char is just fine as?!
if (Character.isISOControl(c)) {
excMsg = "Unexpected character (CTRL-CHAR, code "+i+")"+msg;
} else {
excMsg = "Unexpected character '"+c+"' (code "+i+")"+msg;
}
Location loc = getLocation();
throw new WstxUnexpectedCharException(excMsg, loc, c);
}
撇开有趣的评论不谈,Woodstox正在JDK解析器之上执行一些额外的验证,并拒绝ASCII字符为无效。15
至于为什么那个角色在那里,我们不能告诉你,它在你的数据中。同样,我们无法告诉您删除该字符是否会破坏任何内容,因为同样,这是您的数据。你只能为自己建立这一点。