java - How to parse span title with jsoup? -
i trying parse title of content using jsoup..
<div class="article"> <div class="articlehead review"> <h1 class="item"><span class="fn">onlive</span> review</h1> <h2 class="subgrey"><span class=""></span>cloud gaming has arrived in uk, can our infrastructure make of it?</h2>
i want parse span class onlive review. , sub header
ive tried far..
try{ elements titleelements = jsdoc.getelementsbytag("div"); for(element titleelement : titleelements){ if(titleelement.attr("class").equals("articleheader review")){ element articleheader = jsdoc.select("#item").first(); string header = articleheader.text(); system.out.println(titleelement.text()); title = header.tostring(); log.e("title", title); } } } catch(exception e){ system.out.println("couldnt content"); }
no luck.
there go:
element header = jsdoc.select("h1.item span.fn"); element sub = jsdoc.select("h2.subgrey span");
Comments
Post a Comment