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;
    }