<?php
	set_time_limit(0);
	$f = fopen("C:\Разработка\doc_V02_ZoneToGKN\V02_ZoneToGKN\dGovernance_Code.xsd", "r");
	while(!feof($f)){
		$str = fgets($f);
		if(strpos($str, "value=")){
			for($j = 0;;$j++){
				if($str[$j] == "\"" || $str[$j] == "'")
					break;
			}
			for($j = $j + 1;;$j++){
				if($str[$j] == "\"" || $str[$j] == "'")
					break;
				$code .= $str[$j];	
			}
		}
		if(strpos($str, "<xs:documentation>")){
			for($j = 0;;$j++){
				if($str[$j] == ">")
					break;
			}
			for($j = $j + 1;;$j++){
				if($str[$j] == "<")
					break;
				$name .= $str[$j];	
			}
			$out .= iconv("UTF-8", "Windows-1251", $code.";".$name."\n");
			$code = "";
			$name = "";
		}
	}
	$fout = fopen('dGovernance_Code.csv', "w");
	fwrite($fout, $out);
	fclose($fout);
	fclose($f);
?>