Skip to content
htzh edited this page Oct 18, 2014 · 1 revision

Gumbo is a Google HTML5 parser that just works. The first thing to do is to read up on the examples (find_title.c won't compile nowadays without a cast from (void *) to (GumboNode *)).

While the API is simple, I find the straight use of the C-API inconvenient as one needs to be burdened with details (like avoiding null dereferencing) all the time. Instead I want to wrap the C-API in a very thin layer of C++. So, e.g., instead of directly working with C GumboNode* type I hold it in a very lightweight object:

  class Node {
  public:
    ......
  protected:
    GumboNode* gumbo_node_;
  };

The point of the wrap is so that we can control the access to be as safe and idiomatic (with operator overloading) as possible.

Clone this wiki locally