protected function traverseHeaderTags(\DOMDocument $domDocument, $topLevel, $depth)
    {
        $xpath = new \DOMXPath($domDocument);

        $xpathQuery = sprintf(
            "//*[%s]",
            implode(' or ', array_map(function($v) {
                return sprintf('local-name() = "%s"', $v);
            }, $this->determineHeaderTags($topLevel, $depth)))
        );

        $nodes = [];
        foreach ($xpath->query($xpathQuery) as $node) {
            $nodes[] = $node;
        }

        return new \ArrayIterator($nodes);
    }