我正在尝试“获取”一个 RSS 提要。
public RssFeed(String url) {
_url = url;
String res = this.api.get(url);
ByteArrayInputStream bis = new ByteArrayInputStream(res.getBytes());
try {
bis.close();
} catch (IOException e) {
e.printStackTrace();
}
XMLDecoder decoder = new XMLDecoder(bis);
try {
Object xml = decoder.readObject();
_response = xml.toString();
} catch(Exception e) {
e.printStackTrace();
} finally {
decoder.close();
}
}
当我检查“res”里面的内容时。它似乎得到了整个 XML。但是,我试图解码它,我得到:
java.lang.IllegalArgumentException: Unsupported element: rss
有人可以帮我吗?我是 Java 新手。
谢谢!