protected function marshall(QtiComponent $component)
    {
        $version = $this->getVersion();
        $element = $this->createElement($component);
        $this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());

        if ($component->isFixed() === true) {
            $this->setDOMElementAttribute($element, 'fixed' , true);
        }

        if (Version::compare($version, '2.1.0', '>=') === true && $component->hasTemplateIdentifier() === true) {
            $this->setDOMElementAttribute($element, 'templateIdentifier', $component->getTemplateIdentifier());
        }

        if (Version::compare($version, '2.1.0', '>=') === true && $component->getShowHide() === ShowHide::HIDE) {
            $this->setDOMElementAttribute($element, 'showHide', ShowHide::getNameByConstant(ShowHide::HIDE));
        }

        if (Version::compare($version, '2.1.0', '>=') === true && $component->isRequired() === true) {
            $this->setDOMElementAttribute($element, 'required', true);
        }
        
        if (Version::compare($version, '2.1.0', '<') === true) {
            $matchGroup = $component->getMatchGroup();
            if (count($matchGroup) > 0) {
                $this->setDOMElementAttribute($element, 'matchGroup', implode(' ', $matchGroup->getArrayCopy()));
            }
        }

        $this->fillElement($element, $component);

        return $element;
    }
protected function marshall(QtiComponent $component)
    {
        $version = $this->getVersion();
        $element = $this->createElement($component);
        $this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());

        if ($component->isFixed() === true) {
            $this->setDOMElementAttribute($element, 'fixed' , true);
        }

        if (Version::compare($version, '2.1.0', '>=') === true && $component->hasTemplateIdentifier() === true) {
            $this->setDOMElementAttribute($element, 'templateIdentifier', $component->getTemplateIdentifier());
        }

        if (Version::compare($version, '2.1.0', '>=') === true && $component->getShowHide() === ShowHide::HIDE) {
            $this->setDOMElementAttribute($element, 'showHide', ShowHide::getNameByConstant(ShowHide::HIDE));
        }

        if (Version::compare($version, '2.1.0', '>=') === true && $component->isRequired() === true) {
            $this->setDOMElementAttribute($element, 'required', true);
        }
        
        if (Version::compare($version, '2.1.0', '<') === true) {
            $matchGroup = $component->getMatchGroup();
            if (count($matchGroup) > 0) {
                $this->setDOMElementAttribute($element, 'matchGroup', implode(' ', $matchGroup->getArrayCopy()));
            }
        }

        $this->fillElement($element, $component);

        return $element;
    }
protected function marshall ( QtiComponent $ component ) { $ version = $ this -> getVersion ( ) ; $ element = $ this -> createElement ( $ component ) ; $ this -> setDOMElementAttribute ( $ element , 'identifier' , $ component -> getIdentifier ( ) ) ; if ( $ component -> isFixed ( ) === true ) { $ this -> setDOMElementAttribute ( $ element , 'fixed' , true ) ; } if ( Version :: compare ( $ version , '2.1.0' , '>=' ) === true && $ component -> hasTemplateIdentifier ( ) === true ) { $ this -> setDOMElementAttribute ( $ element , 'templateIdentifier' , $ component -> getTemplateIdentifier ( ) ) ; } if ( Version :: compare ( $ version , '2.1.0' , '>=' ) === true && $ component -> getShowHide ( ) === ShowHide :: HIDE ) { $ this -> setDOMElementAttribute ( $ element , 'showHide' , ShowHide :: getNameByConstant ( ShowHide :: HIDE ) ) ; } if ( Version :: compare ( $ version , '2.1.0' , '>=' ) === true && $ component -> isRequired ( ) === true ) { $ this -> setDOMElementAttribute ( $ element , 'required' , true ) ; } if ( Version :: compare ( $ version , '2.1.0' , '<' ) === true ) { $ matchGroup = $ component -> getMatchGroup ( ) ; if ( count ( $ matchGroup ) > 0 ) { $ this -> setDOMElementAttribute ( $ element , 'matchGroup' , implode ( ' ' , $ matchGroup -> getArrayCopy ( ) ) ) ; } } $ this -> fillElement ( $ element , $ component ) ; return $ element ; }
Marshall a Gap object into a DOMElement object.

@param \qtism\data\QtiComponent $component A Gap object.
@return \DOMElement The according DOMElement object.
@throws \qtism\data\storage\xml\marshalling\MarshallingException
Marshall a Gap object into a DOMElement object .