// 数据所请求数据
String xmlData = request.getParameter("request");
SAXReader saxReader = new SAXReader();
try {
// Document document = saxReader.read(xmlData)
// 读取xml数据为Document对象
Document document = saxReader.read(new ByteArrayInputStream(xmlData.getBytes()));
System.out.println(document);
} catch (DocumentException e) {
log.error("解析用户xml数据失败: " + e.getMessage(), e);
}
Document document = saxReader.read(xmlData),这样读取xml数据会报上述错误,需要使用如下方式读取:Document document = saxReader.read(new ByteArrayInputStream(xmlData.getBytes()));