protected function marshall(QtiComponent $component)
    {
        $element = $this->createElement($component);

        $arrayViews = array();
        foreach ($component->getViews() as $view) {
            $key = array_search($view, View::asArray());
            // replace '_' by the space char.
            $arrayViews[] = strtolower(str_replace("\xf2", "\x20", $key));
        }

        if (count($arrayViews) > 0) {
            $this->setDOMElementAttribute($element, 'view', implode("\x20", $arrayViews));
        }

        if ($component->getUse() != '') {
            $this->setDOMElementAttribute($element, 'use', $component->getUse());
        }

        if ($component->hasXmlBase() === true) {
            static::setXmlBase($element, $component->getXmlBase());
        }

        foreach ($component->getContent() as $block) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($block);
            $element->appendChild($marshaller->marshall($block));
        }

        foreach ($component->getStylesheets() as $stylesheet) {
            $stylesheetMarshaller = $this->getMarshallerFactory()->createMarshaller($stylesheet);
            $element->appendChild($stylesheetMarshaller->marshall($stylesheet));
        }

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

        return $element;
    }