Вопрос по java, saxparser, xml, android, xml-attribute – С SAX Parser получите значение атрибута
Я анализирую XML из Интернета с помощью Android. Код ниже показывает образец XML. У меня проблема в том, что я не могу получить строковое значение тега элемента. Когда я используюname = attributes.getQName(i);
он выводит имя, а не значение атрибута.
<code><weatherdata> <timetags> <item name="date"> <value>20/04/2012</value> <unit/> <image/> <class>dynamic</class> <description>The current date</description> </item> </code>
3
ответа
@Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
if(localName.equalsIgnoreCase("item")){
//currentMessage.setMediaUrl(attributes.getValue(BaseFeedParser.Url));
String valueis=attributes.getValue("name")
}
super.startElement(uri, localName, qName, attributes);
}