C++ Tree Class implementation
Some quick comments:

Const correctness

You really should make your code const correct. 

For example at least these functions could be const declared:

    bool hasChildren();
    bool hasParent();

    TreeNode* getParent();
    TreeNode* getChild(int pos);

    int childrenNumber();
    int grandChildrenNum();

    std::string getTextContent();
    std::string getTagName();


Use references to avoid copies

This:

TreeNode(std::string iTextContent, std::string iTagName);


should be:

TreeNode(const std::string&amp; iTextContent, const std::string&amp; iTagName);


otherwise you are creating temporary copies of the strings when you pass them in.

These functions should return by const reference:

    std::string getTextContent();
    std::string getTagName();


Like so:

    const std::string&amp; getTextContent() const;
    const std::string&amp; getTagName() const;


Otherwise you will be creating unnecessary memory copies each time the function is called even if you just want to look at the value.

Memory leak galore?

Your API requires that you pass in raw pointers and store them in the node. There is no documentation of the ownership of the pointers. Who is responsible for freeing them? Right now all I see is a memory leak waiting to happen. 

In your main code you allocate the nodes with new but C++ is NOT a garbage collected language. You will need to pair each new with a delete to free the memory otherwise you will run out of memory faster than you can say "Holy memory management batman!".

Now, this keeping track of new/delete gets error prone very quickly so since C++11 you are recommended to use smart pointers. A.k.a. std::unique_ptr and std::shared_ptr for just about everything. See also std::make_unique and std::make_shared. There are places where you could/should use pointers, but as I gather that you are new to C++ I will not go into those detail because you can get away with just using smart pointers everywhere for now.

Also you might be interested in reading up on Resource Acquisition Is Initialisation (RAII). We ❤❤❤ RAII in C++.