【发布时间】:2014-09-06 23:55:10
【问题描述】:
我正在解析 XML 文件中的文本和图像。 文字一切正常。 但是当我开始解析图像时,listview 变成了空的。
for (int j = 0; j < clength; j++) {
Node thisNode = nchild.item(j);
String theString = null;
String nodeName = null;
if (thisNode != null && thisNode.getFirstChild() != null) {
theString = thisNode.getFirstChild().getNodeValue();
}
nodeName = thisNode.getNodeName();
if ("title".equals(nodeName)) {
_item.setTitle(theString);
}
if ("pubDate".equals(nodeName)) {
String formatedDate = theString.replace(" +0000", "");
_item.setDate(formatedDate);
}
if (nodeName.equals("enclosure")) {
Element enclosure = (Element) thisNode;
if (enclosure.hasAttr("url")) {
String imageLink = (enclosure.attr("url"));
_item.setImage(imageLink);
}
}
}
所以,据我了解,问题在于从 . 我怎样才能以赖特的方式做到这一点? 太好了!
【问题讨论】: