i'm building android app, , using library jsoup, i'm parsing html don't know how items html
the html:
<div id="polls-687" class="wp-polls"> <form id="polls_form_687" class="wp-polls-form" action="/myurl" method="post"> <p style="display: none;"> <input type="hidden" id="poll_687_nonce" name="wp-polls-nonce" value="6490c2e4b0" /> </p> <p style="display: none;"> <input type="hidden" name="poll_id" value="687" /> </p> <h4>what want hear?</h4> <div id="polls-687-ans" class="wp-polls-ans"> <ul class="wp-polls-ul" style="padding-left:0px;"> <li> <input type="radio" id="poll-answer-2605" name="poll_687" value="2605" /> <label for="poll-answer-2605">cappella - u & me</label> </li> <li> <input type="radio" id="poll-answer-2607" name="poll_687" value="2607" /> <label for="poll-answer-2607">deepest blue - deepest blue</label> </li> <li> <input type="radio" id="poll-answer-2609" name="poll_687" value="2609" /> <label for="poll-answer-2609">britney spears - (hit me baby) 1 more time</label> </li> <li> <input type="radio" id="poll-answer-2611" name="poll_687" value="2611" /> <label for="poll-answer-2611">drukwerk - marianneke</label> </li> </ul> <p style="text-align: left;"> <input type="button" name="vote" value=" stem op deze plaat " class="buttons" onclick="poll_vote(687);" /> </p> <p style="text-align: left;"> </p> </div> </form> </div>
i need labels between li tags. values input tags. i've used link http://jsoup.org/cookbook/extracting-data/attributes-text-html don't know how can specific items require. have experience jsoup , give me advice or examples ?
try this
elements inputelements = document.select("ul li input"); (iterator<element> iterator = inputelements.iterator(); iterator.hasnext();) { element inputelement = iterator.next(); element labelelement = inputelement.nextelementsibling(); system.out.println(inputelement.attr("value")); system.out.println(labelelement.owntext()); }
Comments
Post a Comment