【发布时间】:2011-03-09 01:43:28
【问题描述】:
我正在尝试解析这个xml file,但我找不到从<media:thumbnail width="66" height="49" url="http://news.bbcimg.co.uk/media/images/41447000/jpg/_41447190_exomars66esa.jpg"/> 元素解析 url 属性的方法。我在处理程序类中尝试了以下startElement 方法
public void startElement(String Uri, String localName, String qName,
Attributes atts) throws SAXException {
if (localName.equals("channel")) {
this.in_channel = true;
}else if (localName.equals("item")) {
this.in_item = true;
}else if (localName.equals("title")) {
this.in_title = true;
}else if (localName.equals("media:thumbnail")) {
String attrValue = atts.getValue("url");
item.setLink(attrValue);
}
}
我也试过if (localName.equals("media"),但没有成功
我可以解析像 this<link url="http://achdre.freehostia.com/example.xml"/> 这样的元素,但不能解析我在上面发布的元素。提前谢谢
【问题讨论】:
标签: android xml-namespaces sax