I am trying to parse this content using jsoup.
<div class="imageInlineCenter" style="width: 468px;" align="center"><img src="http://xbox360media.ign.com/xbox360/image/article/117/1171345/MW3_3_468_1306710207.jpg" align="middle" border="0" height="263" width="468"><div class="inlineImageCaption" style="width: 468px;">Your subwoofer will get a break during the stealthy start of the 'Mind the Gap' level, but only briefly.</div></div>
I only want to parse the img src tag to get the image url.
Here's what I am working with right now..
try{
Elements img = jsDoc.select("div.imageInlineCenter");
String imgSrc = img.attr("img src");
System.out.println(imgSrc);
}
catch(Exception e){
Log.e("UPCOMING", "Couldnt retrieve the text");
}
Nothing is being printed out. Instead i am getting the message that it couldnt retrieve it.
How can i parse this?
EDIT:
Here is the code I am using.
It's not showing the catch message, or the system.out.
try {
jsDoc = Jsoup.connect(url).get();
try{
Elements img = jsDoc.select("div.imageInlineCenter img[src]");
String imgSrc = img.attr("src");
System.out.println(imgSrc);
}
catch(Exception e){
Log.e("UPCOMING", "Couldnt retrieve the text");
}