protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     $headers = $component->getHeaders();
     if (count($headers) > 0) {
         self::setDOMElementAttribute($element, 'headers', implode(" ", $headers->getArrayCopy()));
     }
     if ($component->hasScope() === true) {
         self::setDOMElementAttribute($element, 'scope', TableCellScope::getNameByConstant($component->getScope()));
     }
     if ($component->hasAbbr() === true) {
         self::setDOMElementAttribute($element, 'abbr', $component->getAbbr());
     }
     if ($component->hasAxis() === true) {
         self::setDOMElementAttribute($element, 'axis', $component->getAxis());
     }
     if ($component->hasRowspan() === true) {
         self::setDOMElementAttribute($element, 'rowspan', $component->getRowspan());
     }
     if ($component->hasColspan() === true) {
         self::setDOMElementAttribute($element, 'colspan', $component->getColspan());
     }
     foreach ($component->getContent() as $c) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($c);
         $element->appendChild($marshaller->marshall($c));
     }
     self::fillElement($element, $component);
     return $element;
 }
 /**
  * Marshall a HotspotChoice/AssociableHotspot object into a DOMElement object.
  * 
  * @param QtiComponent $component A HotspotChoice/AssociableHotspot 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, 'shape', Shape::getNameByConstant($component->getShape()));
     self::setDOMElementAttribute($element, 'coords', $component->getCoords()->__toString());
     if ($component->isFixed() === true) {
         self::setDOMElementAttribute($element, 'fixed', true);
     }
     if ($component->hasTemplateIdentifier() === true) {
         self::setDOMElementAttribute($element, 'templateIdentifier', $component->getTemplateIdentifier());
     }
     if ($component->getShowHide() === ShowHide::HIDE) {
         self::setDOMElementAttribute($element, 'showHide', ShowHide::getNameByConstant($component->getShowHide()));
     }
     if ($component->hasHotspotLabel() === true) {
         self::setDOMElementAttribute($element, 'hotspotLabel', $component->getHotspotLabel());
     }
     if ($component instanceof AssociableHotspot) {
         self::setDOMElementAttribute($element, 'matchMax', $component->getMatchMax());
         if ($component->getMatchMin() !== 0) {
             self::setDOMElementAttribute($element, 'matchMin', $component->getMatchMin());
         }
     }
     self::fillElement($element, $component);
     return $element;
 }
 /**
  * Marshall a PreCondition object into a DOMElement object.
  * 
  * @param QtiComponent $component A PreCondition object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     $marshaller = $this->getMarshallerFactory()->createMarshaller($component->getExpression());
     $element->appendChild($marshaller->marshall($component->getExpression()));
     return $element;
 }
예제 #4
0
 /**
  * Marshall a VariableMapping object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A VariableMapping object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'sourceIdentifier', $component->getSource());
     self::setDOMElementAttribute($element, 'targetIdentifier', $component->getTarget());
     return $element;
 }
 protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     self::fillElement($element, $component);
     self::setDOMElementAttribute($element, 'responseIdentifier', $component->getResponseIdentifier());
     if ($component->hasPrompt() === true) {
         $element->appendChild($this->getMarshallerFactory()->createMarshaller($component->getPrompt())->marshall($component->getPrompt()));
     }
     if ($component->mustShuffle() !== false) {
         self::setDOMElementAttribute($element, 'shuffle', true);
     }
     if ($component->getMaxAssociations() !== 1) {
         self::setDOMElementAttribute($element, 'maxAssociations', $component->getMaxAssociations());
     }
     if ($component->getMinAssociations() !== 0) {
         self::setDOMElementAttribute($element, 'minAssociations', $component->getMinAssociations());
     }
     if ($component->hasXmlBase() === true) {
         self::setXmlBase($element, $component->getXmlBase());
     }
     foreach ($elements as $e) {
         $element->appendChild($e);
     }
     return $element;
 }
 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;
 }
예제 #7
0
 /**
  * Marshall a BaseValue object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A BaseValue object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'baseType', BaseType::getNameByConstant($component->getBaseType()));
     self::setDOMElementValue($element, $component->getValue());
     return $element;
 }
 /**
  * @see \qtism\data\storage\xml\marshalling\RecursiveMarshaller::marshallChildrenKnown()
  */
 protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $version = $this->getVersion();
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     $this->fillElement($element, $component);
     self::setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
     self::setDOMElementAttribute($element, 'matchMax', $component->getMatchMax());
     if ($component->isFixed() === true) {
         self::setDOMElementAttribute($element, 'fixed', true);
     }
     if ($component->hasTemplateIdentifier() === true && Version::compare($version, '2.1.0', '>=') === true) {
         self::setDOMElementAttribute($element, 'templateIdentifier', $component->getTemplateIdentifier());
     }
     if ($component->getShowHide() !== ShowHide::SHOW && Version::compare($version, '2.1.0', '>=') === true) {
         self::setDOMElementAttribute($element, 'showHide', ShowHide::getNameByConstant(ShowHide::HIDE));
     }
     if ($component->getMatchMin() !== 0 && Version::compare($version, '2.1.0', '>=') === true) {
         self::setDOMElementAttribute($element, 'matchMin', $component->getMatchMin());
     }
     if (Version::compare($version, '2.1.0', '<') === true) {
         $matchGroup = $component->getMatchGroup();
         if (count($matchGroup) > 0) {
             self::setDOMElementAttribute($element, 'matchGroup', implode(' ', $matchGroup->getArrayCopy()));
         }
     }
     foreach ($elements as $e) {
         $element->appendChild($e);
     }
     return $element;
 }
예제 #9
0
 /**
  * Marshall a RandomFloat object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A RandomFloat object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'min', $component->getMin());
     self::setDOMElementAttribute($element, 'max', $component->getMax());
     return $element;
 }
 /**
  * Marshall a RubricBlock object into a DOMElement object.
  * 
  * @param QtiComponent $component A RubricBlock object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     $arrayViews = array();
     foreach ($component->getViews() as $view) {
         $key = array_search($view, View::asArray());
         // replace '_' by the space char.
         $arrayViews[] = strtolower(str_replace("ò", " ", $key));
     }
     if (count($arrayViews) > 0) {
         static::setDOMElementAttribute($element, 'view', implode(" ", $arrayViews));
     }
     if ($component->getUse() != '') {
         static::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));
     }
     self::fillElement($element, $component);
     return $element;
 }
예제 #11
0
 /**
  * Marshall a Selection object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A Selection object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'select', $component->getSelect());
     self::setDOMElementAttribute($element, 'withReplacement', $component->isWithReplacement());
     return $element;
 }
 /**
  * Marshall a Weight object into a DOMElement object.
  * 
  * @param QtiComponent $component A Weight object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
     self::setDOMElementAttribute($element, 'value', $component->getValue());
     return $element;
 }
 public static function buildContent(QtiComponent $component, $content)
 {
     $reflectionClass = new \ReflectionClass($component);
     // TODO: Assumption `setContent` always has content setter on first parameter
     $parameterClass = $reflectionClass->getMethod('setContent')->getParameters()[0]->getClass();
     $contentType = $parameterClass->getShortName();
     try {
         /** @var QtiComponentCollection $content */
         $content = self::validateContent($content);
         if ($contentType === 'InlineCollection') {
             return self::buildInlineCollectionContent($content);
         } elseif ($contentType === 'BlockCollection') {
             return self::buildBlockCollectionContent($content);
         } elseif ($contentType === 'BlockStaticCollection') {
             return self::buildBlockStaticCollectionContent($content);
         } elseif ($contentType === 'FlowCollection') {
             return self::buildFlowCollectionContent($content);
         } elseif ($contentType === 'ObjectFlowCollection') {
             return self::buildFlowCollectionContent($content);
         } elseif ($contentType === 'FlowStaticCollection') {
             return self::buildFlowStaticCollectionContent($content);
         }
         throw new MappingException('Invalid content');
     } catch (\Exception $e) {
         throw new MappingException('Fail mapping `' . $component->getQtiClassName() . '` - ' . $e->getMessage());
     }
 }
 /**
  * Marshall an InterpolationTableEntry object into a DOMElement object.
  * 
  * @param QtiComponent $component An InterpolationTableEntry object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'sourceValue', $component->getSourceValue());
     self::setDOMElementAttribute($element, 'targetValue', $component->getTargetValue());
     self::setDOMElementAttribute($element, 'includeBoundary', $component->doesIncludeBoundary());
     return $element;
 }
예제 #15
0
 /**
  * Marshall an AreaMapEntry object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component An AreaMapEntry object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'shape', Shape::getNameByConstant($component->getShape()));
     self::setDOMElementAttribute($element, 'coords', $component->getCoords());
     self::setDOMElementAttribute($element, 'mappedValue', $component->getMappedValue());
     return $element;
 }
예제 #16
0
 /**
  * @see \qtism\data\storage\xml\marshalling\RecursiveMarshaller::marshallChildrenKnown()
  */
 protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     foreach ($elements as $e) {
         $element->appendChild($e);
     }
     return $element;
 }
예제 #17
0
 /**
  * Unmarshall a StatsOperator object into a QTI statsOperator element.
  *
  * @param \qtism\data\QtiComponent $component The StatsOperator object to marshall.
  * @param array $elements An array of child DOMEelement objects.
  * @return \DOMElement The marshalled QTI statsOperator element.
  */
 protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'name', Statistics::getNameByConstant($component->getName()));
     foreach ($elements as $elt) {
         $element->appendChild($elt);
     }
     return $element;
 }
 /**
  * Marshall an OutcomeProcessing object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component An OutcomeProcessing object.
  * @return \DOMElement The according DOMElement object.
  * @throws \qtism\data\storage\xml\marshalling\MarshallingException
  */
 protected function marshall(QtiComponent $component)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     foreach ($component->getOutcomeRules() as $outcomeRule) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($outcomeRule);
         $element->appendChild($marshaller->marshall($outcomeRule));
     }
     return $element;
 }
 /**
  * Unmarshall an FieldValue object into a QTI fieldValue element.
  * 
  * @param QtiComponent The FieldValue object to marshall.
  * @param array An array of child DOMEelement objects.
  * @return DOMElement The marshalled QTI fieldValue element.
  */
 protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'fieldIdentifier', $component->getFieldIdentifier());
     foreach ($elements as $elt) {
         $element->appendChild($elt);
     }
     return $element;
 }
 /**
  * Unmarshall a RoundTo object into a QTI roundTo element.
  * 
  * @param QtiComponent The RoundTo object to marshall.
  * @param array An array of child DOMEelement objects.
  * @return DOMElement The marshalled QTI roundTo element.
  */
 protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'figures', $component->getFigures());
     self::setDOMElementAttribute($element, 'roundingMode', RoundingMode::getNameByConstant($component->getRoundingMode()));
     foreach ($elements as $elt) {
         $element->appendChild($elt);
     }
     return $element;
 }
 /**
  * Unmarshall a StringMatch object into a QTI stringMatch element.
  * 
  * @param QtiComponent The StringMatch object to marshall.
  * @param array An array of child DOMEelement objects.
  * @return DOMElement The marshalled QTI stringMatch element.
  */
 protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'caseSensitive', $component->isCaseSensitive());
     self::setDOMElementAttribute($element, 'substring', $component->mustSubstring());
     foreach ($elements as $elt) {
         $element->appendChild($elt);
     }
     return $element;
 }
 /**
  * Marshall a Tbody/Thead/Tfoot object into a DOMElement object.
  * 
  * @param QtiComponent $component A TBody/Thead/Tfoot object.
  * @return DOMElement The according DOMElement object.
  * @throws MarshallingException
  */
 protected function marshall(QtiComponent $component)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     foreach ($component->getContent() as $tr) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($tr);
         $element->appendChild($marshaller->marshall($tr));
     }
     self::fillElement($element, $component);
     return $element;
 }
 /**
  * Marshall a Variable object into a DOMElement object.
  * 
  * @param QtiComponent $component A Variable object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
     $weightIdentifier = $component->getWeightIdentifier();
     if (!empty($weightIdentifier)) {
         self::setDOMElementAttribute($element, 'weightIdentifier', $weightIdentifier);
     }
     return $element;
 }
 /**
  * Marshall a TemplateDefault object into a DOMElement object.
  * 
  * @param QtiComponent $component A TemplateDefault object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'templateIdentifier', $component->getTemplateIdentifier());
     $expr = $component->getExpression();
     $exprMarshaller = $this->getMarshallerFactory()->createMarshaller($expr);
     $exprElt = $exprMarshaller->marshall($expr);
     $element->appendChild($exprElt);
     return $element;
 }
예제 #25
0
 /**
  * Marshall a ShufflingGroup object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A ShufflingGroup object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'identifiers', implode(" ", $component->getIdentifiers()->getArrayCopy()));
     $fixedIdentifiers = $component->getFixedIdentifiers();
     if (count($fixedIdentifiers) > 0) {
         self::setDOMElementAttribute($element, 'fixedIdentifiers', implode(" ", $component->getFixedIdentifiers()->getArrayCopy()));
     }
     return $element;
 }
예제 #26
0
 /**
  * Marshall a Shuffling object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A Shuffling object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'responseIdentifier', $component->getResponseIdentifier());
     foreach ($component->getShufflingGroups() as $shufflingGroup) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($shufflingGroup);
         $element->appendChild($marshaller->marshall($shufflingGroup));
     }
     return $element;
 }
 protected function appendChildren(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     try {
         $dom = $component->getXml();
         $node = $fragment->ownerDocument->importNode($dom->documentElement, true);
         $fragment->appendChild($node);
     } catch (RuntimeException $e) {
         $msg = "An error occured while rendering the XML content of the '" . $component->getQtiClassName() . "' external component.";
         throw new RenderingException($msg, RenderingException::UNKNOWN, $e);
     }
 }
 /**
  * Marshall an AssessmentItem object into a DOMElement object.
  * 
  * @param QtiComponent $component An AssessmentItem object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
     self::setDOMElementAttribute($element, 'title', $component->getTitle());
     self::setDOMElementAttribute($element, 'timeDependent', $component->isTimeDependent());
     self::setDOMElementAttribute($element, 'adaptive', $component->isAdaptive());
     if ($component->hasLang() === true) {
         self::setDOMElementAttribute($element, 'lang', $component->getLang());
     }
     if ($component->hasLabel() === true) {
         self::setDOMElementAttribute($element, 'label', $component->getLabel());
     }
     if ($component->hasToolName() === true) {
         self::setDOMElementAttribute($element, 'toolName', $component->getToolName());
     }
     if ($component->hasToolVersion() === true) {
         self::setDOMElementAttribute($element, 'toolVersion', $component->getToolVersion());
     }
     foreach ($component->getResponseDeclarations() as $responseDeclaration) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($responseDeclaration);
         $element->appendChild($marshaller->marshall($responseDeclaration));
     }
     foreach ($component->getOutcomeDeclarations() as $outcomeDeclaration) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($outcomeDeclaration);
         $element->appendChild($marshaller->marshall($outcomeDeclaration));
     }
     foreach ($component->getTemplateDeclarations() as $templateDeclaration) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($templateDeclaration);
         $element->appendChild($marshaller->marshall($templateDeclaration));
     }
     if ($component->hasTemplateProcessing() === true) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($component->getTemplateProcessing());
         $element->appendChild($marshaller->marshall($component->getTemplateProcessing()));
     }
     foreach ($component->getStylesheets() as $stylesheet) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($stylesheet);
         $element->appendChild($marshaller->marshall($stylesheet));
     }
     if ($component->hasItemBody() === true) {
         $itemBody = $component->getItemBody();
         $marshaller = $this->getMarshallerFactory()->createMarshaller($itemBody);
         $element->appendChild($marshaller->marshall($itemBody));
     }
     if ($component->hasResponseProcessing() === true) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($component->getResponseProcessing());
         $element->appendChild($marshaller->marshall($component->getResponseProcessing()));
     }
     foreach ($component->getModalFeedbacks() as $modalFeedback) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($modalFeedback);
         $element->appendChild($marshaller->marshall($modalFeedback));
     }
     return $element;
 }
 /**
  * Marshall a Stylesheet object into a DOMElement object.
  * 
  * @param QtiComponent $component A Stylesheet object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'href', $component->getHref());
     self::setDOMElementAttribute($element, 'media', $component->getMedia());
     self::setDOMElementAttribute($element, 'type', $component->getType());
     if (($title = $component->getTitle()) != '') {
         self::setDOMElementAttribute($element, 'title', $component->getTitle());
     }
     return $element;
 }
 /**
  * Create the RuleProcessor object able to process the  given $rule.
  * 
  * @param QtiComponent $rule A Rule object you want to get the related processor.
  * @return Processable The related RuleProcessor object.
  * @throws RuntimeException If no RuleProcessor can be found for the given $rule.
  */
 public function createProcessor(QtiComponent $rule)
 {
     $qtiClassName = ucfirst($rule->getQtiClassName());
     $nsPackage = 'qtism\\runtime\\rules\\';
     $className = $nsPackage . $qtiClassName . 'Processor';
     if (class_exists($className) === true) {
         return new $className($rule);
     }
     $msg = "The QTI rule class '{$qtiClassName}' has no dedicated RuleProcessor class.";
     throw new RuntimeException($msg);
 }