private function buildObject(DOMElement $data){

        $attributes = $this->extractAttributes($data);
        $returnValue = new QtiObject($attributes);

        if($data->hasChildNodes()){
            $nonEmptyChild = $this->getNonEmptyChildren($data);
            if(count($nonEmptyChild) == 1 && reset($nonEmptyChild)->nodeName == 'object'){
                $alt = $this->buildObject(reset($nonEmptyChild));
                $returnValue->setAlt($alt);
            }else{
                //get the node xml content
                $pattern = array("/^<{$data->nodeName}([^>]*)?>/i", "/<\/{$data->nodeName}([^>]*)?>$/i");
                $content = preg_replace($pattern, '', trim($this->saveXML($data)));
                $returnValue->setAlt($content);
            }
        }else{
            $alt = trim($data->nodeValue);
            if(!empty($alt)){
                $returnValue->setAlt($alt);
            }
        }

        return $returnValue;
    }
private function buildObject(DOMElement $data){

        $attributes = $this->extractAttributes($data);
        $returnValue = new QtiObject($attributes);

        if($data->hasChildNodes()){
            $nonEmptyChild = $this->getNonEmptyChildren($data);
            if(count($nonEmptyChild) == 1 && reset($nonEmptyChild)->nodeName == 'object'){
                $alt = $this->buildObject(reset($nonEmptyChild));
                $returnValue->setAlt($alt);
            }else{
                //get the node xml content
                $pattern = array("/^<{$data->nodeName}([^>]*)?>/i", "/<\/{$data->nodeName}([^>]*)?>$/i");
                $content = preg_replace($pattern, '', trim($this->saveXML($data)));
                $returnValue->setAlt($content);
            }
        }else{
            $alt = trim($data->nodeValue);
            if(!empty($alt)){
                $returnValue->setAlt($alt);
            }
        }

        return $returnValue;
    }
private function buildObject ( DOMElement $ data ) { $ attributes = $ this -> extractAttributes ( $ data ) ; $ returnValue = new QtiObject ( $ attributes ) ; if ( $ data -> hasChildNodes ( ) ) { $ nonEmptyChild = $ this -> getNonEmptyChildren ( $ data ) ; if ( count ( $ nonEmptyChild ) == 1 && reset ( $ nonEmptyChild ) -> nodeName == 'object' ) { $ alt = $ this -> buildObject ( reset ( $ nonEmptyChild ) ) ; $ returnValue -> setAlt ( $ alt ) ; } else { //get the node xml content $ pattern = array ( "/^<{$data->nodeName}([^>]*)?>/i" , "/<\/{$data->nodeName}([^>]*)?>$/i" ) ; $ content = preg_replace ( $ pattern , '' , trim ( $ this -> saveXML ( $ data ) ) ) ; $ returnValue -> setAlt ( $ content ) ; } } else { $ alt = trim ( $ data -> nodeValue ) ; if ( ! empty ( $ alt ) ) { $ returnValue -> setAlt ( $ alt ) ; } } return $ returnValue ; }
Short description of method buildObject

@access private
@author Joel Bout, <joel.bout@tudor.lu>
@param  DOMElement $data
@return \oat\taoQtiItem\model\qti\QtiObject
Short description of method buildObject