我正在尝试使用apache abdera解析在休息调用后从websphere门户收到的响应原子提要。但解析时收到以下错误。有人可以告诉我这是什么问题吗?
org.apache.abdera.parser.stax.FOMUnsupportedTextTypeException:不支持的文本类型:text / html
Abdera abdera = new Abdera();
AbderaClient abderaClient = new AbderaClient(abdera);
Factory factory = abdera.getFactory();
Cookie[] cookies=request.getCookies();
org.apache.commons.httpclient.Cookie ltpaCookieHttpCommons = new org.apache.commons.httpclient.Cookie();
RequestOptions options = new RequestOptions(true);
List<String> cookieStrings = new ArrayList<String>();
options.setHeader("Cookie", (String[])cookieStrings.toArray(new String[cookieStrings.size()]));
ClientResponse resp = abderaClient.get("http://localhost:10039/wps/contenthandler/!ut/p/digest!W9TQFjuU7ADCwtSkxDsxHg/searchfeed/search?queryLang=en&locale=en&resultLang=en&query=test&scope=com.ibm.lotus.search.ALL_SOURCES&start=0&results=10&output=application/xml", options);
System.out.println(resp.getType());
if (resp.getType() == ResponseType.SUCCESS) {
System.out.println("!!!!!!Response success!!!!!!");
Document<Feed> docFeed = resp.getDocument();
// JSON Output
Writer writer = abdera.getWriterFactory().getWriter("json");
try {
Feed feed=docFeed.getRoot();
abdera.getWriterFactory().getWriter("json").writeTo(feed, System.out);
} catch(Exception e) {
e.printStackTrace();
}
} else {
}
答案 0 :(得分:0)
问题在于你的解析原子提供了一个text/html
的类型标记,而不在atom spec中,因此abdera会抛出上述错误。
根据规范:
当存在时,该值 必须是“text”,“html”或“xhtml”之一
您确定Feed是原子Feed而不是支持MIME类型的机箱的RSS源吗?