protected function isAncestor($tagname) {
        $candidate = $this->current;
        while ($candidate->nodeType === XML_ELEMENT_NODE) {
            if ($candidate->tagName == $tagname) {
                return true;
            }
            $candidate = $candidate->parentNode;
        }

        return false;
    }
protected function isAncestor($tagname) {
        $candidate = $this->current;
        while ($candidate->nodeType === XML_ELEMENT_NODE) {
            if ($candidate->tagName == $tagname) {
                return true;
            }
            $candidate = $candidate->parentNode;
        }

        return false;
    }
protected function isAncestor ( $ tagname ) { $ candidate = $ this -> current ; while ( $ candidate -> nodeType === XML_ELEMENT_NODE ) { if ( $ candidate -> tagName == $ tagname ) { return true ; } $ candidate = $ candidate -> parentNode ; } return false ; }
Checks if the given tagname is an ancestor of the present candidate.

If $this->current or anything above $this->current matches the given tag
name, this returns true.
Checks if the given tagname is an ancestor of the present candidate .