从服务器获得响应时,我面临以下错误。
org.jdom.input.JDOMParseException: Error on line 1: Content is not allowed in prolog.
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:468)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:851)
在获得回复的同时,我得到的内容也低于
content = ?<?xml version="1.0" encoding="UTF-8"?>
尽管文件的实际内容是
content = <?xml version="1.0" encoding="UTF-8"?>
我使用的方法如下
@Override
public State onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception {
System.out.println("onBodyPartReceived");
content += new String(bodyPart.getBodyByteBuffer().array(), "UTF-8");
return State.CONTINUE;
}