본문 바로가기

Develop/PHP

[PHP] Make xml 파일

makePomXml();
	}

	private function makePomXml(){
		$this->openURI($this->build_name.'.xml');
		$this->setIndent(true);
		$this->startDocument("1.0", "UTF-8");

		$this->startElement("project");
			$this->writeAttribute("xmlns", "http://maven.apache.org/POM/4.0.0");
			$this->writeAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
			$this->writeAttribute("xsi:schemaLocation", "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd");
			$this->writeElement("modelVersion", "4.0.0");
			$this->writeElement("groupId", $this->option['pom']['group_id']);
			$this->writeElement("artifactId", $this->option['pom']['artifact_id']);
			$this->writeElement("name", $this->project_name);
			$this->writeElement('version', $this->option['pom']['version']);
			$this->startElement("scm");
				$this->writeElement("connection", "scm:svn:".$this->redmine_site);
				$this->writeElement("developerConnection", "scm:svn:".$this->redmine_site);
				$this->writeElement("url", $this->redmine_site);
			$this->endElement();
			$this->startElement("build");
				$this->writeElement("sourceDirectory", $this->option['pom']['src_path']);
			$this->endElement();
			$this->startElement("properties");
				$this->writeElement("sonar.exclusions", $this->option['pom']['exclusions']);
				$this->writeElement("sonar.language", "php");
				if($this->option['pom']['unittest'] == false){
					$this->writeElement("sonar.phpUnit.skip", 'true');
				}else{
					$this->writeElement("sonar.phpUnit.analyzeOnly", 'true');
				}
				if($this->option['pom']['codesniffer'] == false){
					$this->writeElement("sonar.phpCodesniffer.skip", "true");
				}
				if($this->option['pom']['pdepend'] == false){
					$this->writeElement("sonar.phpDepend.skip", "true");
				}
				if($this->option['pom']['phpcpd'] == false){
					$this->writeElement("sonar.phpcpd.skip", "true");
				}
			$this->endElement();
		$this->endElement();

		$this->endDocument();
		$this->flush();
	}
}
/*
$build_no = $argv[1];

$xml = new PomXML($build_no);
*/
?>

이렇게 해주구.. xmlprocess 클래스를 만들어 줘야함..


dbc = mysql_connect($this->HOST, $this->UID, $this->PASS);
		mysql_select_db($this->DB);
		mysql_query("set names utf8;", $this->dbc);
		$this->getInfo($no);

		return;
	}

	public function getInfo($no){
		$sql = "";

		$result = mysql_query($sql, $this->dbc);
		$data = mysql_fetch_array($result);

		$this->build_name = $data['build_name'];
		$this->option = unserialize($data['build_option']);
		$this->project_name = $data['name'];
		$this->redmine_site .= $this->build_name;

		return;
	}
}
?>

'Develop > PHP' 카테고리의 다른 글

[PHP] 괄호 처리  (0) 2012.07.24
[PHP] 특수문자 제거 정규표현식  (0) 2012.07.24
[PHP] Write ini file  (0) 2012.06.25
[PHP] args 쉽게 처리하는 api  (0) 2012.05.15
[PHP] CharSet Check  (0) 2012.04.27