src/XML/RSS/SimpleParser.php
public static function parse( $xml )
	{
		$channelData	= array();
		$itemList		= array();
		$xml	= new SimpleXMLElement( $xml );
		foreach( $xml->channel->children() as $nodeName => $nodeValue )
		{
			if( $nodeName == "image" && $nodeValue->children() )
			{
				$channelData[$nodeName]	= self::readSubSet( $nodeValue );
				continue;
			}
			if( $nodeName == "textInput" && $nodeValue->children() )
			{
				$channelData[$nodeName]	= self::readSubSet( $nodeValue );
				continue;
			}
			if( $nodeName != "item" )
			{
				$channelData[$nodeName]	= (string) $nodeValue;
				continue;
			}
			$item		= array();
			$itemNode	= $nodeValue;
			foreach( $itemNode->children() as $nodeName => $nodeValue )
				$item[$nodeName]	= (string) $nodeValue;
			$itemList[]	= $item;
		}
		$attributes	= $xml->attributes();
		$data	= array(
			'encoding'		=> $attributes['encoding'],
			'channelData'	=> $channelData,
			'itemList'		=> $itemList,
		);
		return $data;
	}
public static function parse( $xml )
	{
		$channelData	= array();
		$itemList		= array();
		$xml	= new SimpleXMLElement( $xml );
		foreach( $xml->channel->children() as $nodeName => $nodeValue )
		{
			if( $nodeName == "image" && $nodeValue->children() )
			{
				$channelData[$nodeName]	= self::readSubSet( $nodeValue );
				continue;
			}
			if( $nodeName == "textInput" && $nodeValue->children() )
			{
				$channelData[$nodeName]	= self::readSubSet( $nodeValue );
				continue;
			}
			if( $nodeName != "item" )
			{
				$channelData[$nodeName]	= (string) $nodeValue;
				continue;
			}
			$item		= array();
			$itemNode	= $nodeValue;
			foreach( $itemNode->children() as $nodeName => $nodeValue )
				$item[$nodeName]	= (string) $nodeValue;
			$itemList[]	= $item;
		}
		$attributes	= $xml->attributes();
		$data	= array(
			'encoding'		=> $attributes['encoding'],
			'channelData'	=> $channelData,
			'itemList'		=> $itemList,
		);
		return $data;
	}
public static function parse ( $ xml ) { $ channelData = array ( ) ; $ itemList = array ( ) ; $ xml = new SimpleXMLElement ( $ xml ) ; foreach ( $ xml -> channel -> children ( ) as $ nodeName => $ nodeValue ) { if ( $ nodeName == "image" && $ nodeValue -> children ( ) ) { $ channelData [ $ nodeName ] = self :: readSubSet ( $ nodeValue ) ; continue ; } if ( $ nodeName == "textInput" && $ nodeValue -> children ( ) ) { $ channelData [ $ nodeName ] = self :: readSubSet ( $ nodeValue ) ; continue ; } if ( $ nodeName != "item" ) { $ channelData [ $ nodeName ] = ( string ) $ nodeValue ; continue ; } $ item = array ( ) ; $ itemNode = $ nodeValue ; foreach ( $ itemNode -> children ( ) as $ nodeName => $ nodeValue ) $ item [ $ nodeName ] = ( string ) $ nodeValue ; $ itemList [ ] = $ item ; } $ attributes = $ xml -> attributes ( ) ; $ data = array ( 'encoding' => $ attributes [ 'encoding' ] , 'channelData' => $ channelData , 'itemList' => $ itemList , ) ; return $ data ; }
Reads RSS from XML statically and returns Array containing Channel Data and Items.
@access		public
@static
@param		string		$xml		XML String to read
@return		array
Reads RSS from XML statically and returns Array containing Channel Data and Items .