protected function run()
    {
        $engine = $this->instantiateEngine();
        $arguments = $this->getArguments();
        
        // Load XML Document.
        $source = $arguments['source'];
        $doc = new XmlDocument();
        $validate = !($arguments['novalidate'] === true);
        
        try {
            $doc->load($source, $validate);
            
            $renderingData = '';
            
            switch (strtolower($arguments['flavour'])) {
                case 'goldilocks':
                    $renderingData = $this->runGoldilocks($doc, $engine);
                    break;
            
                case 'xhtml':
                    $renderingData = $this->runXhtml($doc, $engine);
                    break;
            }
            
            // Add final new line?
            $nl = false;
            if ($arguments['document'] !== true && $arguments['format'] !== true) {
                $nl = true;
            }
            
            $this->out($renderingData, $nl);
            $this->success("QTI XML file successfully rendered.");
        } catch (XmlStorageException $e) {
            switch ($e->getCode()) {
                case XmlStorageException::READ:
                    $msg = "An error occured while reading QTI file '${source}'.\nThe system returned the following error:\n";
                    $msg .= ExceptionUtils::formatMessage($e);
                    $this->fail($msg);
                    break;
                    
                case XmlStorageException::XSD_VALIDATION:
                    $msg = "The QTI file '${source}' is invalid against XML Schema.\nThe system returned the following error:\n";
                    $msg .= ExceptionUtils::formatMessage($e);
                    $this->fail($msg);
                    break;
                    
                case XmlStorageException::VERSION:
                    $msg = "The QTI version of file '${source}' could not be detected.";
                    $this->fail($msg);
                    break;
                    
                default:
                    $msg = "An fatal error occured while reading QTI file '${source}'.";
                    $this->fail($msg);
                    break;
            }
        }
    }
protected function run()
    {
        $engine = $this->instantiateEngine();
        $arguments = $this->getArguments();
        
        // Load XML Document.
        $source = $arguments['source'];
        $doc = new XmlDocument();
        $validate = !($arguments['novalidate'] === true);
        
        try {
            $doc->load($source, $validate);
            
            $renderingData = '';
            
            switch (strtolower($arguments['flavour'])) {
                case 'goldilocks':
                    $renderingData = $this->runGoldilocks($doc, $engine);
                    break;
            
                case 'xhtml':
                    $renderingData = $this->runXhtml($doc, $engine);
                    break;
            }
            
            // Add final new line?
            $nl = false;
            if ($arguments['document'] !== true && $arguments['format'] !== true) {
                $nl = true;
            }
            
            $this->out($renderingData, $nl);
            $this->success("QTI XML file successfully rendered.");
        } catch (XmlStorageException $e) {
            switch ($e->getCode()) {
                case XmlStorageException::READ:
                    $msg = "An error occured while reading QTI file '${source}'.\nThe system returned the following error:\n";
                    $msg .= ExceptionUtils::formatMessage($e);
                    $this->fail($msg);
                    break;
                    
                case XmlStorageException::XSD_VALIDATION:
                    $msg = "The QTI file '${source}' is invalid against XML Schema.\nThe system returned the following error:\n";
                    $msg .= ExceptionUtils::formatMessage($e);
                    $this->fail($msg);
                    break;
                    
                case XmlStorageException::VERSION:
                    $msg = "The QTI version of file '${source}' could not be detected.";
                    $this->fail($msg);
                    break;
                    
                default:
                    $msg = "An fatal error occured while reading QTI file '${source}'.";
                    $this->fail($msg);
                    break;
            }
        }
    }
protected function run ( ) { $ engine = $ this -> instantiateEngine ( ) ; $ arguments = $ this -> getArguments ( ) ; // Load XML Document. $ source = $ arguments [ 'source' ] ; $ doc = new XmlDocument ( ) ; $ validate = ! ( $ arguments [ 'novalidate' ] === true ) ; try { $ doc -> load ( $ source , $ validate ) ; $ renderingData = '' ; switch ( strtolower ( $ arguments [ 'flavour' ] ) ) { case 'goldilocks' : $ renderingData = $ this -> runGoldilocks ( $ doc , $ engine ) ; break ; case 'xhtml' : $ renderingData = $ this -> runXhtml ( $ doc , $ engine ) ; break ; } // Add final new line? $ nl = false ; if ( $ arguments [ 'document' ] !== true && $ arguments [ 'format' ] !== true ) { $ nl = true ; } $ this -> out ( $ renderingData , $ nl ) ; $ this -> success ( "QTI XML file successfully rendered." ) ; } catch ( XmlStorageException $ e ) { switch ( $ e -> getCode ( ) ) { case XmlStorageException :: READ : $ msg = "An error occured while reading QTI file '${source}'.\nThe system returned the following error:\n" ; $ msg .= ExceptionUtils :: formatMessage ( $ e ) ; $ this -> fail ( $ msg ) ; break ; case XmlStorageException :: XSD_VALIDATION : $ msg = "The QTI file '${source}' is invalid against XML Schema.\nThe system returned the following error:\n" ; $ msg .= ExceptionUtils :: formatMessage ( $ e ) ; $ this -> fail ( $ msg ) ; break ; case XmlStorageException :: VERSION : $ msg = "The QTI version of file '${source}' could not be detected." ; $ this -> fail ( $ msg ) ; break ; default : $ msg = "An fatal error occured while reading QTI file '${source}'." ; $ this -> fail ( $ msg ) ; break ; } } }
Renders a QTI XML File into another flavour.

This implementations considers that all necessary checks about
arguments and their values were performed in \qtism\cli\Render::checkArguments().

@see \qtism\cli\Cli::run()
@see \qtism\cli\Render::checkArguments()
Renders a QTI XML File into another flavour .