public function build_tree()
    {
        $html = $this->_dom->getElementsByTagName("html")->item(0);
        if (is_null($html)) {
            $html = $this->_dom->firstChild;
        }

        if (is_null($html)) {
            throw new Exception("Requested HTML document contains no data.");
        }

        $this->fix_tables();

        $this->_root = $this->_build_tree_r($html);
    }