src/XML/OPML/Parser.php
public function parse( $xml )
	{
		$this->tree		= $this->parser->parse( $xml );
		$this->outlines	= array();
		$this->headers->clearOptions();

		foreach( $this->parser->getOptions() as $key => $value )
			$this->headers->setOption( "xml_".$key, $value );
		if( $version = $this->tree->getAttribute( "version" ) )
			$this->headers->setOption( "opml_version", $version );

		foreach( $this->tree->getChildren() as $area )
		{
			$areaName	= $area->getNodeName();
			switch( $areaName )
			{
				case "head":
					$children = $area->getChildren();
					foreach( $children as $nr => $child )
					{
						$childName	= $child->getNodeName();
						$content	= $child->getContent();
						switch( $childName )
						{
							case 'dateCreated':
								$content	= $this->getDate( $content );
								break;
							case 'dateModified':
								$content	= $this->getDate( $content );
								break;
							default:
								break;
						}
						$this->headers->setOption( "opml_".$childName, $content );
					}
					break;
				case "body":
					$this->parseOutlines( $area, $this->outlines );
					break;
				default:
					break;
			}
		}
	}
public function parse( $xml )
	{
		$this->tree		= $this->parser->parse( $xml );
		$this->outlines	= array();
		$this->headers->clearOptions();

		foreach( $this->parser->getOptions() as $key => $value )
			$this->headers->setOption( "xml_".$key, $value );
		if( $version = $this->tree->getAttribute( "version" ) )
			$this->headers->setOption( "opml_version", $version );

		foreach( $this->tree->getChildren() as $area )
		{
			$areaName	= $area->getNodeName();
			switch( $areaName )
			{
				case "head":
					$children = $area->getChildren();
					foreach( $children as $nr => $child )
					{
						$childName	= $child->getNodeName();
						$content	= $child->getContent();
						switch( $childName )
						{
							case 'dateCreated':
								$content	= $this->getDate( $content );
								break;
							case 'dateModified':
								$content	= $this->getDate( $content );
								break;
							default:
								break;
						}
						$this->headers->setOption( "opml_".$childName, $content );
					}
					break;
				case "body":
					$this->parseOutlines( $area, $this->outlines );
					break;
				default:
					break;
			}
		}
	}
public function parse ( $ xml ) { $ this -> tree = $ this -> parser -> parse ( $ xml ) ; $ this -> outlines = array ( ) ; $ this -> headers -> clearOptions ( ) ; foreach ( $ this -> parser -> getOptions ( ) as $ key => $ value ) $ this -> headers -> setOption ( "xml_" . $ key , $ value ) ; if ( $ version = $ this -> tree -> getAttribute ( "version" ) ) $ this -> headers -> setOption ( "opml_version" , $ version ) ; foreach ( $ this -> tree -> getChildren ( ) as $ area ) { $ areaName = $ area -> getNodeName ( ) ; switch ( $ areaName ) { case "head" : $ children = $ area -> getChildren ( ) ; foreach ( $ children as $ nr => $ child ) { $ childName = $ child -> getNodeName ( ) ; $ content = $ child -> getContent ( ) ; switch ( $ childName ) { case 'dateCreated' : $ content = $ this -> getDate ( $ content ) ; break ; case 'dateModified' : $ content = $ this -> getDate ( $ content ) ; break ; default : break ; } $ this -> headers -> setOption ( "opml_" . $ childName , $ content ) ; } break ; case "body" : $ this -> parseOutlines ( $ area , $ this -> outlines ) ; break ; default : break ; } } }
Reads  XML String of OPML Document and builds tree of XML_DOM_Nodes.
@access		public
@param		string		$xml		OPML String parse
@return		void
Reads XML String of OPML Document and builds tree of XML_DOM_Nodes .