protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
     self::setDOMElementAttribute($element, 'navigationMode', NavigationMode::getNameByConstant($component->getNavigationMode()));
     self::setDOMElementAttribute($element, 'submissionMode', SubmissionMode::getNameByConstant($component->getSubmissionMode()));
     foreach ($component->getPreConditions() as $preCondition) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($preCondition);
         $element->appendChild($marshaller->marshall($preCondition));
     }
     foreach ($component->getBranchRules() as $branchRule) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($branchRule);
         $element->appendChild($marshaller->marshall($branchRule));
     }
     $itemSessionControl = $component->getItemSessionControl();
     if (!empty($itemSessionControl)) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($itemSessionControl);
         $element->appendChild($marshaller->marshall($itemSessionControl));
     }
     $timeLimits = $component->getTimeLimits();
     if (!empty($timeLimits)) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($timeLimits);
         $element->appendChild($marshaller->marshall($timeLimits));
     }
     foreach ($component->getAssessmentSections() as $assessmentSection) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($assessmentSection);
         $element->appendChild($marshaller->marshall($assessmentSection));
     }
     foreach ($component->getTestFeedbacks() as $testFeedback) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($testFeedback);
         $element->appendChild($marshaller->marshall($testFeedback));
     }
     return $element;
 }
 /**
  * Marshall an AssessmentTest object into a DOMElement object.
  * 
  * @param QtiComponent $component An AssessmentTest object.
  * @return DOMElement The according DOMElement object.
  * @throws MarshallingException
  */
 protected function marshall(QtiComponent $component)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
     self::setDOMElementAttribute($element, 'title', $component->getTitle());
     $toolName = $component->getToolName();
     if (!empty($toolName)) {
         self::setDOMElementAttribute($element, 'toolName', $component->getToolName());
     }
     $toolVersion = $component->getToolVersion();
     if (!empty($toolVersion)) {
         self::setDOMElementAttribute($element, 'toolVersion', $component->getToolVersion());
     }
     if ($component->hasTimeLimits() === true) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($component->getTimeLimits());
         $element->appendChild($marshaller->marshall($component->getTimeLimits()));
     }
     foreach ($component->getOutcomeDeclarations() as $outcomeDeclaration) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($outcomeDeclaration);
         $element->appendChild($marshaller->marshall($outcomeDeclaration));
     }
     foreach ($component->getTestParts() as $part) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($part);
         $element->appendChild($marshaller->marshall($part));
     }
     $outcomeProcessing = $component->getOutcomeProcessing();
     if (!empty($outcomeProcessing)) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($outcomeProcessing);
         $element->appendChild($marshaller->marshall($outcomeProcessing));
     }
     foreach ($component->getTestFeedbacks() as $feedback) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($feedback);
         $element->appendChild($marshaller->marshall($feedback));
     }
     return $element;
 }