src/FS/File/ICal/Parser.php
protected static function parseRecursive( $type, &$root, &$lines )
	{
		$node = new XML_DOM_Node( strtolower( $type ) );
		$root->addChild( $node );
		while( count( $lines ) )
		{
			$line	= array_shift( $lines );
			$parsed	= self::parseLine( $line );
			if( $parsed['name'] == "END" && $parsed['value'] == $type )
				return $lines;
			else if( $parsed['name'] == "BEGIN" )
				$lines	= self::parseRecursive( $parsed['value'], $node, $lines );
			else
			{
				$child	= new XML_DOM_Node( strtolower( $parsed['name'] ), $parsed['value'] );
				foreach( $parsed['param'] as $param )
				{
					$parts	= explode( "=", $param );
					$child->setAttribute( strtolower( $parts[0] ), $parts[1] );
				}
				$node->addChild( $child );
			}
		}
	}
protected static function parseRecursive( $type, &$root, &$lines )
	{
		$node = new XML_DOM_Node( strtolower( $type ) );
		$root->addChild( $node );
		while( count( $lines ) )
		{
			$line	= array_shift( $lines );
			$parsed	= self::parseLine( $line );
			if( $parsed['name'] == "END" && $parsed['value'] == $type )
				return $lines;
			else if( $parsed['name'] == "BEGIN" )
				$lines	= self::parseRecursive( $parsed['value'], $node, $lines );
			else
			{
				$child	= new XML_DOM_Node( strtolower( $parsed['name'] ), $parsed['value'] );
				foreach( $parsed['param'] as $param )
				{
					$parts	= explode( "=", $param );
					$child->setAttribute( strtolower( $parts[0] ), $parts[1] );
				}
				$node->addChild( $child );
			}
		}
	}
protected static function parseRecursive ( $ type , & $ root , & $ lines ) { $ node = new XML_DOM_Node ( strtolower ( $ type ) ) ; $ root -> addChild ( $ node ) ; while ( count ( $ lines ) ) { $ line = array_shift ( $ lines ) ; $ parsed = self :: parseLine ( $ line ) ; if ( $ parsed [ 'name' ] == "END" && $ parsed [ 'value' ] == $ type ) return $ lines ; else if ( $ parsed [ 'name' ] == "BEGIN" ) $ lines = self :: parseRecursive ( $ parsed [ 'value' ] , $ node , $ lines ) ; else { $ child = new XML_DOM_Node ( strtolower ( $ parsed [ 'name' ] ) , $ parsed [ 'value' ] ) ; foreach ( $ parsed [ 'param' ] as $ param ) { $ parts = explode ( "=" , $ param ) ; $ child -> setAttribute ( strtolower ( $ parts [ 0 ] ) , $ parts [ 1 ] ) ; } $ node -> addChild ( $ child ) ; } } }
Parses iCal Lines and returns a XML Tree recursive.
@access		protected
@static
@param		string			$type			String to unfold
@param		XML_DOM_Node	$root			Parent XML Node
@param		string			$lines			Array of iCal Lines
@return 	void
Parses iCal Lines and returns a XML Tree recursive .