/**
  * run 
  * 
  * @access public
  * @return void
  */
 public function run()
 {
     if (!file_exists($this->__xml_filename) || !file_exists($this->__out_put_dir)) {
         require PATH_DSWAN_LIB . 'sw_exception.class.php';
         throw new sw_exception('database xml desc file or output directory not exists. ');
     }
     $xml2array = sw_xml::factory('xml2array');
     $xml2array->set_filename($this->__xml_filename);
     $array = $xml2array->xml2array();
     $tmp = isset($array['databases']['database'][0]) ? $array['databases']['database'] : $array['databases'];
     $output_str = 'title: Smeta 产品数据字典' . PHP_EOL;
     $output_str .= 'next: inner_api' . PHP_EOL;
     $output_str .= 'prev: evn_deploy' . PHP_EOL;
     $output_str .= '---' . PHP_EOL . PHP_EOL;
     foreach ($tmp as $key => $value) {
         $output = $this->__out_put_dir . self::WIKI_NAME;
         $output_str .= '### ' . $value['@name'] . ' 数据库 ###' . PHP_EOL . PHP_EOL;
         $tmp_table = isset($value['tables']['table'][0]) ? $value['tables']['table'] : $value['tables'];
         foreach ($tmp_table as $table) {
             $output_str .= $this->_parse_table($table);
         }
         file_put_contents($output, $output_str);
     }
 }
 /**
  * run 
  * 
  * @access public
  * @return void
  */
 public function run()
 {
     if (!file_exists($this->__xml_filename) || !file_exists($this->__out_put_dir)) {
         require PATH_DSWAN_LIB . 'sw_exception.class.php';
         throw new sw_exception('database xml desc file or output directory not exists. ');
     }
     $xml2array = sw_xml::factory('xml2array');
     $xml2array->set_filename($this->__xml_filename);
     $array = $xml2array->xml2array();
     $tmp = isset($array['databases']['database'][0]) ? $array['databases']['database'] : $array['databases'];
     foreach ($tmp as $key => $value) {
         $output = $this->__out_put_dir . self::PREFIX . $value['@name'] . '.sql';
         $output_str = self::SQL_COMMENT . self::SPACE_KEY . self::VIM_HEADER . PHP_EOL;
         $output_str .= self::SQL_COMMENT . PHP_EOL;
         $output_str .= self::SQL_COMMENT . 'Current Database: `' . $value['@name'] . '`';
         $output_str .= self::SQL_COMMENT . PHP_EOL . PHP_EOL;
         $output_str .= 'CREATE DATABASE /*!32312 IF NOT EXISTS*/ `' . $value['@name'] . '` /*!40100 DEFAULT CHARACTER SET utf8 */;' . PHP_EOL . PHP_EOL;
         $output_str .= 'USE `' . $value['@name'] . '`;' . PHP_EOL;
         $tmp_table = isset($value['tables']['table'][0]) ? $value['tables']['table'] : $value['tables'];
         foreach ($tmp_table as $table) {
             $output_str .= $this->_parse_table($table);
         }
         file_put_contents($output, $output_str);
     }
 }