Exemple #1
0
 function write(phpMorphy_Dict_Source_SourceInterface $source)
 {
     $this->getObserver()->onStart();
     try {
         $source = phpMorphy_Dict_Source_ValidatingSource::wrap($source);
         $xml_opts = $this->getXmlOptions();
         $writer = $this->createXmlWriter($this->path);
         $writer->startDocument($xml_opts['xml_version'], $xml_opts['xml_encoding']);
         //$writer->writeDtd('phpmorphy', $xml_opts['dtd_pub_id'], $xml_opts['dtd_sys_id']);
         $writer->writeComment('This file generated with ' . __CLASS__ . ' at ' . date('r'));
         // morphy
         $writer->startElement('phpmorphy');
         $this->writeOptions($writer, $source);
         $this->writePoses($writer, $source->getPoses());
         $this->writeGrammems($writer, $source->getGrammems());
         $this->writeAncodes($writer, $source->getAncodes());
         $this->writeFlexias($writer, $source->getFlexias());
         $this->writePrefixes($writer, $source->getPrefixes());
         $this->writeLemmas($writer, $source->getLemmas());
         $writer->endElement();
         $writer->endDocument();
     } catch (Exception $e) {
         $this->getObserver()->onEnd();
         throw $e;
     }
     $this->getObserver()->onEnd();
 }
Exemple #2
0
 function write(phpMorphy_Dict_Source_SourceInterface $source)
 {
     $this->getObserver()->onStart();
     try {
         $source = phpMorphy_Dict_Source_ValidatingSource::wrap($source);
         $this->writePoses($this->openFile($this->poses_file), $source->getPoses());
         $this->writeGrammems($this->openFile($this->grammems_file), $source->getGrammems());
         $this->writeAncodes($this->openFile($this->ancodes_file), $source->getAncodes());
         $this->writeFlexias($this->openFile($this->flexias_file), $source->getFlexias());
         $this->writePrefixes($this->openFile($this->prefixes_file), $source->getPrefixes());
         $this->writeLemmas($this->openFile($this->lemmas_file), $source->getLemmas());
     } catch (Exception $e) {
         $this->getObserver()->onEnd();
         throw $e;
     }
     $this->getObserver()->onEnd();
 }