对于 XML parsing issue with '&' in element text 讨论的问题,我有同样的问题,但处理之前&
更换&
不能解决问题XML中元素的文本解析与“&”问题继续
这里是我的代码:
convertedString = convertedString.replaceAll("& ", "&");
convertedString = StringEscapeUtils.unescapeHtml(convertedString);
这里是我的错误:
[Fatal Error] :1:253: The entity name must immediately follow the '&' in the entity reference.
org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
...
感激,如果有人可以帮助,非常感谢
你不应该逃避'&'?你为什么试图更换它?这是不是基本上是你从前面的问题相同的问题? – MadProgrammer
[XML元素文本中'&'解析问题]的可能重复(http://stackoverflow.com/questions/3838316/xml-parsing-issue-with-in-element-text) – EJP
嗨,大家好,我已经更新了我上面的问题,对于混淆感到抱歉 – dale