src/XML/Element.php
public function setValue( $value, $cdata = FALSE )
	{
		if( !is_string( $value ) && $value !== NULL )
			throw new InvalidArgumentException( 'Value must be a string or NULL' );

		$value	= preg_replace( "/(.*)<!\[CDATA\[(.*)\]\]>(.*)/iU", "\\1\\2\\3", $value );
		if( $cdata || preg_match( '/&|</', $value ) )												//  string is known or detected to be CDATA
		{
			$dom	= dom_import_simplexml( $this );												//  import node in DOM
			$cdata	= $dom->ownerDocument->createCDATASection( $value );							//  create a new CDATA section
			$dom->nodeValue	= "";																	//  clear node content
			$dom->appendChild( $cdata );															//  add CDATA section
		}
		else 																						//  normal node content
		{
			dom_import_simplexml( $this )->nodeValue	= $value;									//  set node content
		}
	}
public function setValue( $value, $cdata = FALSE )
	{
		if( !is_string( $value ) && $value !== NULL )
			throw new InvalidArgumentException( 'Value must be a string or NULL' );

		$value	= preg_replace( "/(.*)<!\[CDATA\[(.*)\]\]>(.*)/iU", "\\1\\2\\3", $value );
		if( $cdata || preg_match( '/&|</', $value ) )												//  string is known or detected to be CDATA
		{
			$dom	= dom_import_simplexml( $this );												//  import node in DOM
			$cdata	= $dom->ownerDocument->createCDATASection( $value );							//  create a new CDATA section
			$dom->nodeValue	= "";																	//  clear node content
			$dom->appendChild( $cdata );															//  add CDATA section
		}
		else 																						//  normal node content
		{
			dom_import_simplexml( $this )->nodeValue	= $value;									//  set node content
		}
	}
public function setValue ( $ value , $ cdata = FALSE ) { if ( ! is_string ( $ value ) && $ value !== NULL ) throw new InvalidArgumentException ( 'Value must be a string or NULL' ) ; $ value = preg_replace ( "/(.*)<!\[CDATA\[(.*)\]\]>(.*)/iU" , "\\1\\2\\3" , $ value ) ; if ( $ cdata || preg_match ( '/&|</' , $ value ) ) //  string is known or detected to be CDATA { $ dom = dom_import_simplexml ( $ this ) ; //  import node in DOM $ cdata = $ dom -> ownerDocument -> createCDATASection ( $ value ) ; //  create a new CDATA section $ dom -> nodeValue = "" ; //  clear node content $ dom -> appendChild ( $ cdata ) ; //  add CDATA section } else //  normal node content { dom_import_simplexml ( $ this ) -> nodeValue = $ value ; //  set node content } }
Returns Text Value.
@access		public
@return		string
Returns Text Value .