protected function marshall(QtiComponent $component)
    {
        $element = parent::marshall($component);

        $this->setDOMElementAttribute($element, 'href', $component->getHref());

        // Deal with categories.
        $categories = $component->getCategories();
        if (count($categories) > 0) {
            $this->setDOMElementAttribute($element, 'category', implode("\x20", $categories->getArrayCopy()));
        }

        // Deal with variableMappings.
        $variableMappings = $component->getVariableMappings();
        foreach ($variableMappings as $mapping) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($mapping);
            $element->appendChild($marshaller->marshall($mapping));
        }

        // Deal with weights.
        $weights = $component->getWeights();
        foreach ($weights as $weight) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($weight);
            $element->appendChild($marshaller->marshall($weight));
        }

        // Deal with templateDefaults.
        $templateDefaults = $component->getTemplateDefaults();
        foreach ($templateDefaults as $default) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($default);
            $element->appendChild($marshaller->marshall($default));
        }

        return $element;
    }
protected function marshall(QtiComponent $component)
    {
        $element = parent::marshall($component);

        $this->setDOMElementAttribute($element, 'href', $component->getHref());

        // Deal with categories.
        $categories = $component->getCategories();
        if (count($categories) > 0) {
            $this->setDOMElementAttribute($element, 'category', implode("\x20", $categories->getArrayCopy()));
        }

        // Deal with variableMappings.
        $variableMappings = $component->getVariableMappings();
        foreach ($variableMappings as $mapping) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($mapping);
            $element->appendChild($marshaller->marshall($mapping));
        }

        // Deal with weights.
        $weights = $component->getWeights();
        foreach ($weights as $weight) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($weight);
            $element->appendChild($marshaller->marshall($weight));
        }

        // Deal with templateDefaults.
        $templateDefaults = $component->getTemplateDefaults();
        foreach ($templateDefaults as $default) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($default);
            $element->appendChild($marshaller->marshall($default));
        }

        return $element;
    }
protected function marshall ( QtiComponent $ component ) { $ element = parent :: marshall ( $ component ) ; $ this -> setDOMElementAttribute ( $ element , 'href' , $ component -> getHref ( ) ) ; // Deal with categories. $ categories = $ component -> getCategories ( ) ; if ( count ( $ categories ) > 0 ) { $ this -> setDOMElementAttribute ( $ element , 'category' , implode ( "\x20" , $ categories -> getArrayCopy ( ) ) ) ; } // Deal with variableMappings. $ variableMappings = $ component -> getVariableMappings ( ) ; foreach ( $ variableMappings as $ mapping ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ mapping ) ; $ element -> appendChild ( $ marshaller -> marshall ( $ mapping ) ) ; } // Deal with weights. $ weights = $ component -> getWeights ( ) ; foreach ( $ weights as $ weight ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ weight ) ; $ element -> appendChild ( $ marshaller -> marshall ( $ weight ) ) ; } // Deal with templateDefaults. $ templateDefaults = $ component -> getTemplateDefaults ( ) ; foreach ( $ templateDefaults as $ default ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ default ) ; $ element -> appendChild ( $ marshaller -> marshall ( $ default ) ) ; } return $ element ; }
Marshall an AssessmentItemRef object into a DOMElement object.

@param \qtism\data\QtiComponent $component An assessmentItemRef object.
@return \DOMElement The according DOMElement object.
@throws \qtism\data\storage\xml\marshalling\MarshallingException
Marshall an AssessmentItemRef object into a DOMElement object .