src/XML/Element.php
public function setAttribute( $name, $value, $nsPrefix = NULL, $nsURI = NULL )
	{
		if( $value !== NULL )
		{
			if( !$this->hasAttribute( $name, $nsPrefix ) )
				return $this->addAttribute( $name, $value, $nsPrefix, $nsURI );
			$this->removeAttribute( $name, $nsPrefix );
			$this->addAttribute( $name, $value, $nsPrefix, $nsURI );
		}
		else if( $this->hasAttribute( $name, $nsPrefix ) )
		{
			$this->removeAttribute( $name, $nsPrefix );
		}
	}
public function setAttribute( $name, $value, $nsPrefix = NULL, $nsURI = NULL )
	{
		if( $value !== NULL )
		{
			if( !$this->hasAttribute( $name, $nsPrefix ) )
				return $this->addAttribute( $name, $value, $nsPrefix, $nsURI );
			$this->removeAttribute( $name, $nsPrefix );
			$this->addAttribute( $name, $value, $nsPrefix, $nsURI );
		}
		else if( $this->hasAttribute( $name, $nsPrefix ) )
		{
			$this->removeAttribute( $name, $nsPrefix );
		}
	}
public function setAttribute ( $ name , $ value , $ nsPrefix = NULL , $ nsURI = NULL ) { if ( $ value !== NULL ) { if ( ! $ this -> hasAttribute ( $ name , $ nsPrefix ) ) return $ this -> addAttribute ( $ name , $ value , $ nsPrefix , $ nsURI ) ; $ this -> removeAttribute ( $ name , $ nsPrefix ) ; $ this -> addAttribute ( $ name , $ value , $ nsPrefix , $ nsURI ) ; } else if ( $ this -> hasAttribute ( $ name , $ nsPrefix ) ) { $ this -> removeAttribute ( $ name , $ nsPrefix ) ; } }
Sets an attribute from by it's name.
Adds attribute if not existing.
Removes attribute if value is NULL.
@access		public
@param		string		$name		Name of attribute
@param		string		$value		Value of attribute, NULL means removal
@param		string		$nsPrefix	Namespace prefix of attribute
@param		string		$nsURI		Namespace URI of attribute
@return		void
Sets an attribute from by it s name . Adds attribute if not existing . Removes attribute if value is NULL .