Я использую XmlPullParser для разбора XML-файла, я успешно загрузил все остальные теги, но я хочу знать, как извлечь изображение из этого тега и строку описания, как показано ниже
Изображение
img border='0'
src='https://www.eyefootball.com/imghold/thumbChristianEriksen_2019.jpg'>
эта строка тоже
<BR>Christian Eriksen has reportedly made the decision to leave Tottenham
Hotspur in the New Year after declining to sign a new contract.</p>
это весь тег, который содержит их оба
<description><![CDATA[<p><A
HREF='https://www.eyefootball.com/news/42653/Christian-Eriksen-Tottenham-
Hotspur-transfer-decision.html'><img border='0'
src='https://www.eyefootball.com/imghold/thumbChristianEriksen_2019.jpg'></A>
<BR>Christian Eriksen has reportedly made the decision to leave Tottenham
Hotspur in the New Year after declining to sign a new contract.</p>]]> </description>
Вот так я получаю данные из xml
try {
URL url = new URL("https://www.eyefootball.com/football_news.xml");
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(false);
XmlPullParser xpp = factory.newPullParser();
xpp.setInput(GetInputStream(url), "utf-8");
boolean insideItem = false;
int eventType = xpp.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
if (eventType == XmlPullParser.START_TAG) {
if (xpp.getName().equalsIgnoreCase("item")) {
insideItem = true;
} else if (xpp.getName().equalsIgnoreCase("title")) {
if (insideItem) {
rssModel.setTitle(xpp.nextText());
}
} else if (xpp.getName().equalsIgnoreCase("pubDate")) {
if (insideItem) {
rssModel.setPublished(xpp.nextText());
}
} else if (xpp.getName().equalsIgnoreCase("guid")) {
if (insideItem) {
rssModel.setLinks(xpp.nextText());
}
} else if (xpp.getName().equalsIgnoreCase("description")) {
/// i want to get the child tags ( img and last line ) from
/// descritpion tag
}
} else if (eventType == XmlPullParser.END_TAG && xpp.getName().equalsIgnoreCase("item")) {
insideItem = false;
list.add(rssModel);
}
eventType = xpp.next();
}
} catch (MalformedURLException e) {
exception = e;
} catch (XmlPullParserException e) {
exception = e;
} catch (IOException e) {
exception = e;
}
}
Спасибо