src/XML/DOM/FileEditor.php
public function removeNode( $nodePath )
	{
		$pathNodes	= explode( "/", $nodePath );
		$nodeName	= array_pop( $pathNodes );
		$nodePath	= implode( "/", $pathNodes );
		$nodeNumber	= 0;
		$branch		= $this->getNode( $nodePath );
		if( preg_match_all( "@^(.*)\[([0-9]+)\]$@", $nodeName, $matches ) )
		{
			$nodeName	= $matches[1][0];
			$nodeNumber	= $matches[2][0];
		}
		$nodes		=& $branch->getChildren();
		$index		= -1;
		for( $i=0; $i<count( $nodes ); $i++ )
		{
			if( !$nodeName || $nodes[$i]->getNodeName() == $nodeName )
			{
				$index++;
				if( $index != $nodeNumber ) 
					continue;
				unset( $nodes[$i] );
				return (bool) $this->write();
			}
		}
		throw new InvalidArgumentException( 'Node not found.' );
	}
public function removeNode( $nodePath )
	{
		$pathNodes	= explode( "/", $nodePath );
		$nodeName	= array_pop( $pathNodes );
		$nodePath	= implode( "/", $pathNodes );
		$nodeNumber	= 0;
		$branch		= $this->getNode( $nodePath );
		if( preg_match_all( "@^(.*)\[([0-9]+)\]$@", $nodeName, $matches ) )
		{
			$nodeName	= $matches[1][0];
			$nodeNumber	= $matches[2][0];
		}
		$nodes		=& $branch->getChildren();
		$index		= -1;
		for( $i=0; $i<count( $nodes ); $i++ )
		{
			if( !$nodeName || $nodes[$i]->getNodeName() == $nodeName )
			{
				$index++;
				if( $index != $nodeNumber ) 
					continue;
				unset( $nodes[$i] );
				return (bool) $this->write();
			}
		}
		throw new InvalidArgumentException( 'Node not found.' );
	}
public function removeNode ( $ nodePath ) { $ pathNodes = explode ( "/" , $ nodePath ) ; $ nodeName = array_pop ( $ pathNodes ) ; $ nodePath = implode ( "/" , $ pathNodes ) ; $ nodeNumber = 0 ; $ branch = $ this -> getNode ( $ nodePath ) ; if ( preg_match_all ( "@^(.*)\[([0-9]+)\]$@" , $ nodeName , $ matches ) ) { $ nodeName = $ matches [ 1 ] [ 0 ] ; $ nodeNumber = $ matches [ 2 ] [ 0 ] ; } $ nodes = & $ branch -> getChildren ( ) ; $ index = - 1 ; for ( $ i = 0 ; $ i < count ( $ nodes ) ; $ i ++ ) { if ( ! $ nodeName || $ nodes [ $ i ] -> getNodeName ( ) == $ nodeName ) { $ index ++ ; if ( $ index != $ nodeNumber ) continue ; unset ( $ nodes [ $ i ] ) ; return ( bool ) $ this -> write ( ) ; } } throw new InvalidArgumentException ( 'Node not found.' ) ; }
Removes a Node by its Path.
@access		public
@param		string		$nodePath		Path to Node in XML Tree
@return		bool
Removes a Node by its Path .