protected function buildNamespaceTree(\DOMDocument $dom)
    {
        $xpath = new \DOMXPath($dom);
        $namespaces = array();
        $qry = $xpath->query('//@namespace');
        for ($i = 0; $i < $qry->length; $i++) {
            if (isset($namespaces[$qry->item($i)->nodeValue])) {
                continue;
            }

            $namespaces[$qry->item($i)->nodeValue] = true;
        }

        $namespaces = $this->generateNamespaceTree(array_keys($namespaces));
        $this->generateNamespaceElements($namespaces, $dom->documentElement);
    }
protected function buildNamespaceTree(\DOMDocument $dom)
    {
        $xpath = new \DOMXPath($dom);
        $namespaces = array();
        $qry = $xpath->query('//@namespace');
        for ($i = 0; $i < $qry->length; $i++) {
            if (isset($namespaces[$qry->item($i)->nodeValue])) {
                continue;
            }

            $namespaces[$qry->item($i)->nodeValue] = true;
        }

        $namespaces = $this->generateNamespaceTree(array_keys($namespaces));
        $this->generateNamespaceElements($namespaces, $dom->documentElement);
    }
protected function buildNamespaceTree ( \ DOMDocument $ dom ) { $ xpath = new \ DOMXPath ( $ dom ) ; $ namespaces = array ( ) ; $ qry = $ xpath -> query ( '//@namespace' ) ; for ( $ i = 0 ; $ i < $ qry -> length ; $ i ++ ) { if ( isset ( $ namespaces [ $ qry -> item ( $ i ) -> nodeValue ] ) ) { continue ; } $ namespaces [ $ qry -> item ( $ i ) -> nodeValue ] = true ; } $ namespaces = $ this -> generateNamespaceTree ( array_keys ( $ namespaces ) ) ; $ this -> generateNamespaceElements ( $ namespaces , $ dom -> documentElement ) ; }
Collects all namespaces and sub-namespaces, and adds a new section in
the DOM to provide an overview.

@param \DOMDocument $dom Namespaces are extracted and a summary inserted
in this object.

@return void
Collects all namespaces and sub - namespaces and adds a new section in the DOM to provide an overview .