Results 1 to 1 of 1
  1. #1
    vitaly87 is offline Member
    Join Date
    Mar 2010
    Rep Power

    Default how to get the right node from web with html parser

    Hello all!
    I want to get all nodes the have :
    <div class="user-thread">
    of others,the structure is
    Java Code:
    <div class="user-thread">
    <ul class="uinfo2"><li class="uname2"><b>Farzam</b></li>
    <li class="ureport"><span title="Report inappropriate content"><a href="#" onClick="ReportW('1998748');return false">Report</a></span></li></ul>
    <p class="uopin">
    <span class="uinreply" title="Dear All, 
    can anyone tell me the best jailbreak for my iphone 4.2.1? 
    many thanks">> In reply to amir @ 2010-12-12 13:18 from 3ZIs</span>salam dada khubi bebin jailbreak kolan ta jay ke man midunam ba cidya injam mishe vali agar kam jilbreak nakoni ke khube??? man hamin jurish kheili raziam:D</p>
    <ul class="uinfo">
    <li class="ureply"><span title="Reply to this post"><a href="postopinion.php3?idPhone=3275&idOpinion=1998748">Reply</a></span></li>		
    <li class="upost">2010-12-13 13:52</li>
    <li class="ulocation">
    <span title="Encoded location">Sc{a</span></li>
    <li class="utype"><span title="Type: Reply to post / answer to question">
    I use the org.htmlparser.Parser;
    But I just dont know how to get specific nodes with that class name,
    my code is:
    Java Code:
     public void extractNode(String url) throws ParserException{
     Parser parser = new Parser();
            //<meta name="description" content="Some texte about the site." />
            HasAttributeFilter filter = new HasAttributeFilter("class", "user-thread");
            try {
                NodeList list = parser.parse(filter);
                Node node = list.elementAt(0);
                    // Prints: "YouTube is a place to discover, watch, upload and share videos."
            } catch (ParserException e) {
    can you help me? thanks a lot.
    Last edited by vitaly87; 12-13-2010 at 02:51 PM.

Similar Threads

  1. HTML parser
    By Yuuki in forum New To Java
    Replies: 4
    Last Post: 10-25-2010, 11:32 AM
  2. problems with html parser
    By vitaly87 in forum Advanced Java
    Replies: 0
    Last Post: 03-13-2010, 01:37 PM
  3. Problem with HTML parser
    By kpraveenreddy in forum New To Java
    Replies: 0
    Last Post: 03-02-2010, 02:12 PM
  4. Jericho HTML Parser 2.6
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 06-26-2008, 06:22 PM
  5. Jericho HTML Parser 2.4
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-21-2007, 10:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts