private function printStack() {
        $names = array();
        foreach ($this->stack as $i => $element) {
            $names[] = $element->tagName;
        }
        echo "  -> stack [" . implode(', ', $names) . "]\n";
    }