feed - How to successfully parse images from within content:encoded tags using SAX? -
i trying parse , display images feed has imgage url inside tags. example this:
*note>> http://someimage.jpg not real image link, example. have done far.
public void startelement(string uri, string localname, string qname, attributes atts) { chars = new stringbuilder(); if (qname.equalsignorecase("content:encoded")) { if (!atts.getvalue("src").tostring().equalsignorecase("null")) { feedstr.setimglink(atts.getvalue("src").tostring()); log.d(tag, "inside if " + feedstr.getimglink()); } else { feedstr.setimglink(""); log.d(tag, feedstr.getimglink()); } } }
i believe part of programming needs tweaked. first, when qname equal "content:encoded" parsing stops. application runs endlessly , displays nothing. second, if change initial if qname cannot equal "purplebunny" works perfect, except there no images. missing? using atts.getvalue properly? have used log see comes in imglink , null always.
you can store content:encoded
data in string. can extract image library jsoup
example:
suppose content:encoded
raw data stored in description
variable.
document doc = jsoup.parse(description); element image =doc.select("img").first(); string url = image.absurl("src");
Comments
Post a Comment