Beispiel #1
0
 /** 
  * Load XMI from a file
  * 
  * @param string $filepath Filepath
  */
 public function load($filepath)
 {
     if (file_exists($filepath)) {
         $this->xmi = file_get_contents($filepath);
     } else {
         throw new PHP_UML_Exception('Could not open ' . $filepath);
     }
     $xmlDom = new DomDocument();
     $xmlDom->loadXML($this->xmi);
     if (self::isVersion1($xmlDom)) {
         $this->xmi = PHP_UML_Output_ExporterXSL::convertTo2($this->xmi);
     }
 }
Beispiel #2
0
 /**
  * Implementation of tickFile(): we update the model with the information
  * found in the XMI file. 
  * 
  * @param string $fileBase Directory path
  * @param string $filePath File name
  *
  * @see PHP_UML/UML/FileScanner#tickFile()
  */
 public function tickFile($fileBase, $filePath)
 {
     $filename = $fileBase . $filePath;
     if (!(file_exists($filename) && is_readable($filename))) {
         throw new PHP_UML_Exception('Could not read ' . $filename . '.');
     }
     $doc = new DOMDocument();
     if (!$doc->load($filename)) {
         return;
     }
     if (PHP_UML_Output_XmiDocument::isVersion1($doc)) {
         $xmi = PHP_UML_Output_ExporterXSL::convertTo2($doc->saveXML());
         $doc->loadXML($xmi);
     }
     $builder = new PHP_UML_Input_XMI_Builder();
     $builder->setModel($this->model);
     $builder->buildDom($doc);
     $this->model = $builder->getModel();
 }