0
我想解析這xml file,但我找不到解析url屬性
<media:thumbnail width="66" height="49" url="http://news.bbcimg.co.uk/media/images/41447000/jpg/_41447190_exomars66esa.jpg"/>
元素。我用下面的方法startElement
嘗試了我的處理程序類從基於xmlns的元素解析SAX在Android中的元素
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")
,但沒有奏效
我可以分析一個元素這樣<link url="http://achdre.freehostia.com/example.xml"/>
,但不是我張貼以上。在此先感謝
非常感謝,這工作得很好:) – pmantz 2011-03-09 12:01:36
@ demian83如果你寫**縮略圖**,而不是'(localName.equals(「media:thumbnail」))',它會工作。 – ozmank 2011-11-14 08:14:50