src/XML/DOM/PEAR/PackageReader.php
public function getPackageDataFromXmlFile( $fileName )
	{
		$package	= array(
			'name'			=> NULL,
			'summary'		=> NULL,
			'description'	=> NULL,
			'maintainers'	=> array(),
			'release'		=> array(),
			'changes'		=> array(),
		);

		$xml	= FS_File_Reader::load( $fileName );
		$doc	= new DOMDocument();
		$doc->preserveWhiteSpace	= FALSE;
		$doc->validateOnParse		= !TRUE;
		$doc->loadXml( $xml );
		foreach( $doc->childNodes as $node )
		{
			if( $node->nodeType == 1 )
			{
				$root	= $node;
				break;
			}
		}
		if( !$root )
			throw Exception( 'No root node found.' );
		
		foreach( $root->childNodes as $node )
		{
			$nodeName	= strToLower( $node->nodeName );
			switch( $nodeName )
			{
				case 'maintainers':
					foreach( $node->childNodes as $maintainer )
						$package['maintainers'][]	= $this->readMaintainer( $maintainer );
					break;
				case 'release':
					$package['releases'][]	= $this->readRelease( $node );
					break;
				case 'changelog':
					foreach( $node->childNodes as $release )
						$package['changes'][]	= $this->readRelease( $release );
					break;
				default:
					$package[$nodeName]	= $this->getNodeValue( $node );
					break;
			}
		}
		return $package;
	}
public function getPackageDataFromXmlFile( $fileName )
	{
		$package	= array(
			'name'			=> NULL,
			'summary'		=> NULL,
			'description'	=> NULL,
			'maintainers'	=> array(),
			'release'		=> array(),
			'changes'		=> array(),
		);

		$xml	= FS_File_Reader::load( $fileName );
		$doc	= new DOMDocument();
		$doc->preserveWhiteSpace	= FALSE;
		$doc->validateOnParse		= !TRUE;
		$doc->loadXml( $xml );
		foreach( $doc->childNodes as $node )
		{
			if( $node->nodeType == 1 )
			{
				$root	= $node;
				break;
			}
		}
		if( !$root )
			throw Exception( 'No root node found.' );
		
		foreach( $root->childNodes as $node )
		{
			$nodeName	= strToLower( $node->nodeName );
			switch( $nodeName )
			{
				case 'maintainers':
					foreach( $node->childNodes as $maintainer )
						$package['maintainers'][]	= $this->readMaintainer( $maintainer );
					break;
				case 'release':
					$package['releases'][]	= $this->readRelease( $node );
					break;
				case 'changelog':
					foreach( $node->childNodes as $release )
						$package['changes'][]	= $this->readRelease( $release );
					break;
				default:
					$package[$nodeName]	= $this->getNodeValue( $node );
					break;
			}
		}
		return $package;
	}
public function getPackageDataFromXmlFile ( $ fileName ) { $ package = array ( 'name' => NULL , 'summary' => NULL , 'description' => NULL , 'maintainers' => array ( ) , 'release' => array ( ) , 'changes' => array ( ) , ) ; $ xml = FS_File_Reader :: load ( $ fileName ) ; $ doc = new DOMDocument ( ) ; $ doc -> preserveWhiteSpace = FALSE ; $ doc -> validateOnParse = ! TRUE ; $ doc -> loadXml ( $ xml ) ; foreach ( $ doc -> childNodes as $ node ) { if ( $ node -> nodeType == 1 ) { $ root = $ node ; break ; } } if ( ! $ root ) throw Exception ( 'No root node found.' ) ; foreach ( $ root -> childNodes as $ node ) { $ nodeName = strToLower ( $ node -> nodeName ) ; switch ( $ nodeName ) { case 'maintainers' : foreach ( $ node -> childNodes as $ maintainer ) $ package [ 'maintainers' ] [ ] = $ this -> readMaintainer ( $ maintainer ) ; break ; case 'release' : $ package [ 'releases' ] [ ] = $ this -> readRelease ( $ node ) ; break ; case 'changelog' : foreach ( $ node -> childNodes as $ release ) $ package [ 'changes' ] [ ] = $ this -> readRelease ( $ release ) ; break ; default : $ package [ $ nodeName ] = $ this -> getNodeValue ( $ node ) ; break ; } } return $ package ; }
Reads Package XML File and returns found Information as Array.
@access		public
@param		string		$fileName		Name of Package XML File
@return		array
Reads Package XML File and returns found Information as Array .