/**
  * Marshall a VariableDeclaration object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component An OutcomeDeclaration 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, 'cardinality', Cardinality::getNameByConstant($component->getCardinality()));
     if ($component->getBaseType() != -1) {
         self::setDOMElementAttribute($element, 'baseType', BaseType::getNameByConstant($component->getBaseType()));
     }
     // deal with default value.
     if ($component->getDefaultValue() != null) {
         $defaultValue = $component->getDefaultValue();
         $defaultValueMarshaller = $this->getMarshallerFactory()->createMarshaller($defaultValue, array($component->getBaseType()));
         $element->appendChild($defaultValueMarshaller->marshall($defaultValue));
     }
     return $element;
 }
 /**
  * Marshall an AreaMapping object into a DOMElement object.
  * 
  * @param QtiComponent $component An AreaMapping object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'defaultValue', $component->getDefaultValue());
     if ($component->hasLowerBound() === true) {
         self::setDOMElementAttribute($element, 'lowerBound', $component->getLowerBound());
     }
     if ($component->hasUpperBound() === true) {
         self::setDOMElementAttribute($element, 'upperBound', $component->getUpperBound());
     }
     foreach ($component->getAreaMapEntries() as $entry) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($entry);
         $element->appendChild($marshaller->marshall($entry));
     }
     return $element;
 }
 /**
  * Marshall a MatchTable object into a DOMElement object.
  * 
  * @param QtiComponent $component A MatchTable object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     foreach ($component->getMatchTableEntries() as $matchTableEntry) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($matchTableEntry, array($this->getBaseType()));
         $element->appendChild($marshaller->marshall($matchTableEntry));
     }
     if ($component->getDefaultValue() !== null) {
         static::setDOMElementAttribute($element, 'defaultValue', $component->getDefaultValue());
     }
     return $element;
 }