/**
  * Unmarshall a DOMElement object corresponding to a QTI responseDeclaration element.
  * 
  * @param DOMElement $element A DOMElement object.
  * @return QtiComponent A ResponseDeclaration object.
  * @throws UnmarshallingException 
  */
 protected function unmarshall(DOMElement $element)
 {
     try {
         $baseComponent = parent::unmarshall($element);
         $object = new ResponseDeclaration($baseComponent->getIdentifier());
         $object->setBaseType($baseComponent->getBaseType());
         $object->setCardinality($baseComponent->getCardinality());
         $object->setDefaultValue($baseComponent->getDefaultValue());
         $correctResponseElts = self::getChildElementsByTagName($element, 'correctResponse');
         if (count($correctResponseElts) === 1) {
             $correctResponseElt = $correctResponseElts[0];
             $marshaller = $this->getMarshallerFactory()->createMarshaller($correctResponseElt, array($baseComponent->getBaseType()));
             $object->setCorrectResponse($marshaller->unmarshall($correctResponseElt));
         }
         $mappingElts = self::getChildElementsByTagName($element, 'mapping');
         if (count($mappingElts) === 1) {
             $mappingElt = $mappingElts[0];
             $marshaller = $this->getMarshallerFactory()->createMarshaller($mappingElt, array($baseComponent->getBaseType()));
             $object->setMapping($marshaller->unmarshall($mappingElt));
         }
         $areaMappingElts = self::getChildElementsByTagName($element, 'areaMapping');
         if (count($areaMappingElts) === 1) {
             $areaMappingElt = $areaMappingElts[0];
             $marshaller = $this->getMarshallerFactory()->createMarshaller($areaMappingElt);
             $object->setAreaMapping($marshaller->unmarshall($areaMappingElt));
         }
         return $object;
     } catch (InvalidArgumentException $e) {
         $msg = "An unexpected error occured while unmarshalling the responseDeclaration.";
         throw new UnmarshallingException($msg, $element, $e);
     }
 }