public function load($resolveXInclude = false){
        
        $returnValue = null;

        if(!$this->valid){
            libxml_use_internal_errors(true); //retrieve errors if no validation has been done previously
        }

        //load it using the DOMDocument library
        $xml = new DOMDocument();
        
        switch($this->sourceType){
            case self::SOURCE_FLYFILE:
                if ($this->source->exists()) {
                    $xml->load($this->source->read());
                }
                break;
            case self::SOURCE_FILE:
                $xml->load($this->source);
                break;
            case self::SOURCE_URL:
                $xmlContent = tao_helpers_Request::load($this->source, true);
                $xml->loadXML($xmlContent);
                break;
            case self::SOURCE_STRING:
                $xml->loadXML($this->source);
                break;
        }

        if($xml !== false){

            $basePath = '';
            if($this->sourceType == self::SOURCE_FILE || $this->sourceType == self::SOURCE_URL){
                $basePath = dirname($this->source).'/';
            }
            //build the item from the xml
            $parserFactory = new ParserFactory($xml, $basePath);
            try{
                $returnValue = $parserFactory->load();
            }catch(UnsupportedQtiElement $e){
                $this->addError($e);
            }

            if(!$this->valid){
                $this->valid = true;
                libxml_clear_errors();
            }
        }else if(!$this->valid){
            $this->addErrors(libxml_get_errors());
            libxml_clear_errors();
        }

        return $returnValue;
    }
public function load($resolveXInclude = false){
        
        $returnValue = null;

        if(!$this->valid){
            libxml_use_internal_errors(true); //retrieve errors if no validation has been done previously
        }

        //load it using the DOMDocument library
        $xml = new DOMDocument();
        
        switch($this->sourceType){
            case self::SOURCE_FLYFILE:
                if ($this->source->exists()) {
                    $xml->load($this->source->read());
                }
                break;
            case self::SOURCE_FILE:
                $xml->load($this->source);
                break;
            case self::SOURCE_URL:
                $xmlContent = tao_helpers_Request::load($this->source, true);
                $xml->loadXML($xmlContent);
                break;
            case self::SOURCE_STRING:
                $xml->loadXML($this->source);
                break;
        }

        if($xml !== false){

            $basePath = '';
            if($this->sourceType == self::SOURCE_FILE || $this->sourceType == self::SOURCE_URL){
                $basePath = dirname($this->source).'/';
            }
            //build the item from the xml
            $parserFactory = new ParserFactory($xml, $basePath);
            try{
                $returnValue = $parserFactory->load();
            }catch(UnsupportedQtiElement $e){
                $this->addError($e);
            }

            if(!$this->valid){
                $this->valid = true;
                libxml_clear_errors();
            }
        }else if(!$this->valid){
            $this->addErrors(libxml_get_errors());
            libxml_clear_errors();
        }

        return $returnValue;
    }
public function load ( $ resolveXInclude = false ) { $ returnValue = null ; if ( ! $ this -> valid ) { libxml_use_internal_errors ( true ) ; //retrieve errors if no validation has been done previously } //load it using the DOMDocument library $ xml = new DOMDocument ( ) ; switch ( $ this -> sourceType ) { case self :: SOURCE_FLYFILE : if ( $ this -> source -> exists ( ) ) { $ xml -> load ( $ this -> source -> read ( ) ) ; } break ; case self :: SOURCE_FILE : $ xml -> load ( $ this -> source ) ; break ; case self :: SOURCE_URL : $ xmlContent = tao_helpers_Request :: load ( $ this -> source , true ) ; $ xml -> loadXML ( $ xmlContent ) ; break ; case self :: SOURCE_STRING : $ xml -> loadXML ( $ this -> source ) ; break ; } if ( $ xml !== false ) { $ basePath = '' ; if ( $ this -> sourceType == self :: SOURCE_FILE || $ this -> sourceType == self :: SOURCE_URL ) { $ basePath = dirname ( $ this -> source ) . '/' ; } //build the item from the xml $ parserFactory = new ParserFactory ( $ xml , $ basePath ) ; try { $ returnValue = $ parserFactory -> load ( ) ; } catch ( UnsupportedQtiElement $ e ) { $ this -> addError ( $ e ) ; } if ( ! $ this -> valid ) { $ this -> valid = true ; libxml_clear_errors ( ) ; } } else if ( ! $ this -> valid ) { $ this -> addErrors ( libxml_get_errors ( ) ) ; libxml_clear_errors ( ) ; } return $ returnValue ; }
load the file content, parse it  and build the a QTI_Item instance

@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@param boolean resolveXInclude
@return \oat\taoQtiItem\model\qti\Item
load the file content parse it and build the a QTI_Item instance