public function loadItemFromFile($file)
    {
        $returnValue = null;

        if (is_string($file) && !empty($file)) {

            //validate the file to import
            try {
                $qtiParser = new Parser($file);
                $qtiParser->validate();

                if (!$qtiParser->isValid()) {
                    throw new ParsingException($qtiParser->displayErrors());
                }

                $returnValue = $qtiParser->load();
            } catch(ParsingException $pe) {
                throw new ParsingException($pe->getMessage());
            } catch(Exception $e) {
                throw new Exception("Unable to load file {$file} caused  by {$e->getMessage()}");
            }
        }

        return $returnValue;
    }
public function loadItemFromFile($file)
    {
        $returnValue = null;

        if (is_string($file) && !empty($file)) {

            //validate the file to import
            try {
                $qtiParser = new Parser($file);
                $qtiParser->validate();

                if (!$qtiParser->isValid()) {
                    throw new ParsingException($qtiParser->displayErrors());
                }

                $returnValue = $qtiParser->load();
            } catch(ParsingException $pe) {
                throw new ParsingException($pe->getMessage());
            } catch(Exception $e) {
                throw new Exception("Unable to load file {$file} caused  by {$e->getMessage()}");
            }
        }

        return $returnValue;
    }
public function loadItemFromFile ( $ file ) { $ returnValue = null ; if ( is_string ( $ file ) && ! empty ( $ file ) ) { //validate the file to import try { $ qtiParser = new Parser ( $ file ) ; $ qtiParser -> validate ( ) ; if ( ! $ qtiParser -> isValid ( ) ) { throw new ParsingException ( $ qtiParser -> displayErrors ( ) ) ; } $ returnValue = $ qtiParser -> load ( ) ; } catch ( ParsingException $ pe ) { throw new ParsingException ( $ pe -> getMessage ( ) ) ; } catch ( Exception $ e ) { throw new Exception ( "Unable to load file {$file} caused  by {$e->getMessage()}" ) ; } } return $ returnValue ; }
Load a QTI item from a qti file in parameter.

@param $file
@return null|Item
@throws Exception
@throws ParsingException
Load a QTI item from a qti file in parameter .