Which HTML parser is the best?

Discussion in 'iOS Programming' started by mikezang, Nov 26, 2010.

  1. mikezang macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
  2. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #2
    I have to answer by myself.

    Objective-C HTML Parser is very simple, only four files, but has bug.
    Hpple also looks like with bug.
    XPathQuery is the simplest in two files, but seems like only support XML.

    ElementParser is big with a lot files, but it has a demo and now I am using it.
     
  3. (marc) macrumors 6502a

    (marc)

    Joined:
    Sep 15, 2010
    Location:
    the woods
    #3
    lixml2 also contains an HTML parser. I remember the never-finished MacRumors app used it.
     
  4. KeyideasTeam macrumors newbie

    Joined:
    Mar 10, 2015
    #4
    HTML parser for Objc

    Are you able to parse table ?I want to parse complex HTML page, It contains table.What would be the best way to do this?Right now I am using TFHpple. But I am facing difficulties while parsing complex table data with different fonts.Is there any library in Objective C which give the same result like JSOUP in java.
     
  5. DennisBlah macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #5
    What is your goal for parsing html pages ?
    To download all content to the device for offline use ? Or strip out certain parts from html or ... ?
     
  6. parks daniel macrumors newbie

    Joined:
    Feb 9, 2015
    #6
    my favourite

    The best one that I've used so far is HtmlCleaner :rolleyes:
    HtmlCleaner is open-source HTML parser written in Java. HTML found on Web is usually dirty, ill-formed and unsuitable for further processing. For any serious consumption of such documents, it is necessary to first clean up the mess and bring the order to tags, attributes and ordinary text.
     
  7. KeyideasTeam macrumors newbie

    Joined:
    Mar 10, 2015
    #7

    I am getting html response from web page and have to display some of its data to tableview.
     
  8. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #8
    Do you have control over the server that is producing the web page? If so, perhaps you should consider having it respond with XML or JSON which are more easily consumed and have better parsing tools available, including built-in ones.
     
  9. DennisBlah macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #9

    As dejo already questioned, are you the 'admin' of the webpage? Then you can generate some simpler page or something.

    If not, you might be doing an parse with javascript, and inject it to the page to get result.
    But then indeed you need some more knowledge of javascript and how the tables are build with idnames or column numbers.

    Code:
    NSString *myJavascriptResult = [myWebview stringByEvaluatingJavaScriptFromString: @"return \"Some returning value\";"];
    NSLog(myJavascriptResult);
    
     
  10. moonman239 macrumors 68000

    Joined:
    Mar 27, 2009
    #10
    If you're the server admin then, as has already been suggested, just create a new Webpage that displays the info you want. Then you can display that information in your app using a UIWebView.
     
  11. waterskier2007 macrumors 68000

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #11
    I would disagree with that. WebViews in apps are normally less than ideal. Instead OP should just set up the server to return some easily digestible data like JSON or XML and display that
     

Share This Page