public function getNamespaces(\DOMElement $element = null)
    {
        if ($this->xpath === null) {
            $this->xpath = new \DOMXPath($this);
        }

        if ($element === null) {
            $nodes = $this->xpath->query('namespace::*');
        } else {
            $nodes = $this->xpath->query('namespace::*', $element);
        }

        $ns = array();

        if ($nodes) {
            foreach ($nodes as $node) {
                $arr = $element->getAttribute($node->nodeName);

                if ($arr) {
                    $ns[$node->nodeName] = $arr;
                }
            }

            $nodes = null;
        }

        return $ns;
    }
public function getNamespaces(\DOMElement $element = null)
    {
        if ($this->xpath === null) {
            $this->xpath = new \DOMXPath($this);
        }

        if ($element === null) {
            $nodes = $this->xpath->query('namespace::*');
        } else {
            $nodes = $this->xpath->query('namespace::*', $element);
        }

        $ns = array();

        if ($nodes) {
            foreach ($nodes as $node) {
                $arr = $element->getAttribute($node->nodeName);

                if ($arr) {
                    $ns[$node->nodeName] = $arr;
                }
            }

            $nodes = null;
        }

        return $ns;
    }
public function getNamespaces ( \ DOMElement $ element = null ) { if ( $ this -> xpath === null ) { $ this -> xpath = new \ DOMXPath ( $ this ) ; } if ( $ element === null ) { $ nodes = $ this -> xpath -> query ( 'namespace::*' ) ; } else { $ nodes = $ this -> xpath -> query ( 'namespace::*' , $ element ) ; } $ ns = array ( ) ; if ( $ nodes ) { foreach ( $ nodes as $ node ) { $ arr = $ element -> getAttribute ( $ node -> nodeName ) ; if ( $ arr ) { $ ns [ $ node -> nodeName ] = $ arr ; } } $ nodes = null ; } return $ ns ; }
Get namespace attributes from root element or specific element

@param \DOMElement $element
@throws \Inphinit\Experimental\Exception
@return void
Get namespace attributes from root element or specific element