You can use Dom parser to parse the decription tag and then ue regex on the string to extract url. You can use other parsers also. The below is an example of how to use dom and retrieve the image url.
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(open);// open is the xml file to parse
NodeList title = doc.getElementsByTagName("description");
Element line = (Element) title.item(0);
Log.i("CDATA Content ","" + getCharacterDataFromElement(line));
Matcher matcher = Pattern.compile("<img src=\"([^\"]+)").matcher(getCharacterDataFromElement(line));
while (matcher.find()) {
Log.i("img url: " ,""+ matcher.group(1));
}
The getCharacterDataFromElement
private String getCharacterDataFromElement(Element line) {
// TODO Auto-generated method stub
Node child = line.getFirstChild();
if (child instanceof CharacterData) {
CharacterData cd = (CharacterData) child;
return cd.getData();
}
return "";
}
LogCat Output
CData Content:(1508): <img src="http://l.yimg.com/a/i/us/we/52/38.gif"/><br />
CData Content:(1508): <b>Current Conditions:</b><br />
CData Content:(1508): Thunder in the Vicinity, 32 C<BR />
CData Content:(1508): <BR /><b>Forecast:</b><BR />
CData Content:(1508): Tue - Scattered Thunderstorms. High: 31 Low: 25<br />
CData Content:(1508): Wed - Scattered Thunderstorms. High: 31 Low: 25<br />
CData Content:(1508): Thu - Scattered Thunderstorms. High: 31 Low: 25<br />
CData Content:(1508): Fri - Isolated Thunderstorms. High: 31 Low: 25<br />
CData Content:(1508): Sat - Scattered Thunderstorms. High: 31 Low: 25<br />
CData Content:(1508): <br />
CData Content:(1508): <a href="http://us.rd.yahoo.com/dailynews/rss/weather/Singapore__SG/*http://weather.yahoo.com/forecast/SNXX0006_c.html">Full Forecast at Yahoo! Weather</a><BR/><BR/>
CData Content:(1508): (provided by <a href="http://www.weather.com" >The Weather Channel</a>)<br/>
img url:(1508): http://l.yimg.com/a/i/us/we/52/38.gif ---> image url