DOM/DOMXPathNavigator.php
public function MoveToNextNamespace( $namespaceScope = XPathNamespaceScope::Local )
	{
		if ( is_null( $this->domNode ) ) return false;
		if ( $this->domNode->nodeType != XML_NAMESPACE_DECL_NODE ) return false;

		$expression = $namespaceScope == XPathNamespaceScope::Local
			? 'namespace::*[not(. = ../../namespace::*)]'
			: 'namespace::*';

		$xpath = new \DOMXPath( $this->domNode->nodeType == XML_DOCUMENT_NODE ? $this->domNode : $this->domNode->ownerDocument );
		$namespaces = $xpath->query( $expression, $this->domNode->parentNode );

		if ( ! count( $namespaces ) ) return false;

		// Find the current node among the enties in the $namespaces list
		$current = -1;
		foreach ( $namespaces as $node )
		{
			$current++;
			// Can't use the ->isSameNode() function with a DOMNamespaceNode for some reason
			// So this concoction is used instead.
			if ( $this->domNode->parentNode->getNodePath()  . "/" . $this->domNode->nodeName == $node->parentNode->getNodePath()  . "/" . $node->nodeName )
			{
				break;
			}
		}

		if ( $current <= 0 ) return false;

		$current--;

		$this->domNode = $namespaces[ $current ];
		return true;
	}
public function MoveToNextNamespace( $namespaceScope = XPathNamespaceScope::Local )
	{
		if ( is_null( $this->domNode ) ) return false;
		if ( $this->domNode->nodeType != XML_NAMESPACE_DECL_NODE ) return false;

		$expression = $namespaceScope == XPathNamespaceScope::Local
			? 'namespace::*[not(. = ../../namespace::*)]'
			: 'namespace::*';

		$xpath = new \DOMXPath( $this->domNode->nodeType == XML_DOCUMENT_NODE ? $this->domNode : $this->domNode->ownerDocument );
		$namespaces = $xpath->query( $expression, $this->domNode->parentNode );

		if ( ! count( $namespaces ) ) return false;

		// Find the current node among the enties in the $namespaces list
		$current = -1;
		foreach ( $namespaces as $node )
		{
			$current++;
			// Can't use the ->isSameNode() function with a DOMNamespaceNode for some reason
			// So this concoction is used instead.
			if ( $this->domNode->parentNode->getNodePath()  . "/" . $this->domNode->nodeName == $node->parentNode->getNodePath()  . "/" . $node->nodeName )
			{
				break;
			}
		}

		if ( $current <= 0 ) return false;

		$current--;

		$this->domNode = $namespaces[ $current ];
		return true;
	}
public function MoveToNextNamespace ( $ namespaceScope = XPathNamespaceScope :: Local ) { if ( is_null ( $ this -> domNode ) ) return false ; if ( $ this -> domNode -> nodeType != XML_NAMESPACE_DECL_NODE ) return false ; $ expression = $ namespaceScope == XPathNamespaceScope :: Local ? 'namespace::*[not(. = ../../namespace::*)]' : 'namespace::*' ; $ xpath = new \ DOMXPath ( $ this -> domNode -> nodeType == XML_DOCUMENT_NODE ? $ this -> domNode : $ this -> domNode -> ownerDocument ) ; $ namespaces = $ xpath -> query ( $ expression , $ this -> domNode -> parentNode ) ; if ( ! count ( $ namespaces ) ) return false ; // Find the current node among the enties in the $namespaces list
 $ current = - 1 ; foreach ( $ namespaces as $ node ) { $ current ++ ; // Can't use the ->isSameNode() function with a DOMNamespaceNode for some reason
 // So this concoction is used instead.
 if ( $ this -> domNode -> parentNode -> getNodePath ( ) . "/" . $ this -> domNode -> nodeName == $ node -> parentNode -> getNodePath ( ) . "/" . $ node -> nodeName ) { break ; } } if ( $ current <= 0 ) return false ; $ current -- ; $ this -> domNode = $ namespaces [ $ current ] ; return true ; }
When overridden in a derived class, moves the XPathNavigator to the next namespace node matching the
XPathNamespaceScope specified.

@param XPathNamespaceScope $namespaceScope : (optional) An XPathNamespaceScope value describing the namespace scope.
@return bool Returns true if the XPathNavigator is successful moving to the next namespace node; otherwise,
false. If false, the position of the XPathNavigator is unchanged.
When overridden in a derived class moves the XPathNavigator to the next namespace node matching the XPathNamespaceScope specified .