Results 1 to 4 of 4
  1. #1
    magic is offline Member
    Join Date
    Jun 2010
    Posts
    1
    Rep Power
    0

    Default incompatible types error

    hi,
    can anyone help me !!!
    this is the java code:

    // extract page title and links

    Parser parser = new Parser(url.toString());

    NodeList titleList = parser.parse(new NodeClassFilter (TitleTag.class));

    String title = (titleList.size() != 0) ? ((TitleTag) titleList.elementAt(0)).getTitle() : "";

    parser.reset();

    NodeList list = parser.parse (new NodeClassFilter (LinkTag.class));



    and the error is :

    test.java:112: incompatible types
    found : void
    required: org.htmlparser.util.NodeList
    NodeList titleList = parser.parse(new NodeClassFilter (TitleTag.class));
    ^
    test.java:115: incompatible types
    found : void
    required: org.htmlparser.util.NodeList
    NodeList list = parser.parse (new NodeClassFilter (LinkTag.class));
    ^
    2 errors


    please i need help it's most important.
    thank

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,386
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by magic View Post
    please i need help it's most important.
    To whom? Your parser doesn't return anything at all (it's a void method) and you are erroneously expecting it to return some type; that's what your compiler already told you.

    kind regards,

    Jos

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    When all else fails read the API doc!

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,386
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Norm View Post
    When all else fails read the API doc!
    Reading? Isn't that the ancient lost art that makes your eyeballs bleed? Today we program by banging our keyboards and when it doesn't work we ask the forums; preferably more than one because we want to get our boilerplate code as fast as possible!

    kind regards,

    Jos ;-)

Similar Threads

  1. Replies: 1
    Last Post: 03-10-2010, 01:53 PM
  2. Incompatible operand types int and double[][]
    By Haske2r in forum New To Java
    Replies: 2
    Last Post: 01-21-2010, 05:26 PM
  3. Incompatible types
    By coltragon in forum New To Java
    Replies: 5
    Last Post: 01-15-2010, 04:47 PM
  4. Replies: 6
    Last Post: 10-08-2008, 08:09 AM
  5. problem with scanner class:incompatible types
    By fred in forum New To Java
    Replies: 1
    Last Post: 07-20-2007, 07:02 AM

Tags for this Thread

Posting Permissions

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