我有startElement方法的以下代码
@Override
public void startElement(String uri, String localname, String qname,
Attributes atts) throws SAXException {
if (localname.trim().equals("item"))
this.in_item = true;
else if (localname.trim().equals("title"))
this.in_title = true;
else if (localname.trim().equals("link"))
this.in_link = true;
else if (localname.trim().equals("description"))
this.in_description = true;
else if (localname.trim().equals("category"))
this.in_category = true;
else if (localname.trim().equals("pubDate"))
this.in_pubdate = true;
else if ((qname.trim().equals("media:thumbnail")) || (qname.trim().equals("media:content")))
{
this.in_media = true;
String width = atts.getValue("width");
Integer tmp =Integer.parseInt(width);
if (tmp > currentitem.getMedia_width()) {
String link = atts.getValue("url");
currentItem.setmedia() = link;
currentItem.media_width() = tmp;
}
}
}
我正在检查媒体宽度以解析现有图像中较大的图像 问题是解析器只解析第一个项目的媒体,并将其用于以下所有项目。有人认为出了什么问题?