8
I'd like to ask what is the best way to parse a simple html code into DOM Node tree like this one:

Here are some constraints I am facing:
- HTML code will have only pair tags, no attributes and I've to ignore spaces
- There can be Text between tags like
<p>,<h1>,<a>etc. - I can't use libraries
I was thinking about regex, but never tried it so.. Any ideas?
Every node in the tree is this struct:
typedef struct tag
{
struct tag* parent;
struct tag* nextSibling;
struct tag* previousSibling;
struct tag* firstChild;
struct tag* lastChild;
char* name;
char* text;
}node;