在我的Java项目中,我通过http://x-stream.github.io/解析传入的xml
这是我的代码:
try {
Account account = (Account) xstream.fromXML(oneM2DocumentAsString);
} catch (StreamException ex) {
logger.error("Error message " + ex.getMessage(), ex);
}
在xml中使用符号“&”时,出现错误:
[java] [26.08.2018 14:49:05.641] myproject.M2XMLParser.parseOne(M2XMLParser.java:229) ERROR:
[java] Error message : The entity name must immediately follow the '&' in the entity reference.
[java] com.thoughtworks.xstream.io.StreamException: : The entity name must immediately follow the '&' in the entity reference.
[java] at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:105)
[java] at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:77)
[java] at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1040)
[java] at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1031)
但是我需要知道: