protected function unmarshall(DOMElement $element)
    {
        try {
            // identifier is a mandatory value for the variableDeclaration element.
            if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {

                // cardinality is a mandatory value too.
                if (($cardinality = $this->getDOMElementAttributeAs($element, 'cardinality')) !== null) {
                    $object = new VariableDeclaration($identifier, -1, Cardinality::getConstantByName($cardinality));

                    // deal with baseType.
                    $baseType = $this->getDOMElementAttributeAs($element, 'baseType');
                    if (!empty($baseType)) {
                        $object->setBaseType(BaseType::getConstantByName($baseType));
                    }

                    // set up optional default value.
                    $defaultValueElements = $element->getElementsByTagName('defaultValue');
                    if ($defaultValueElements->length == 1) {
                        $defaultValueElement = $defaultValueElements->item(0);
                        $defaultValueMarshaller = $this->getMarshallerFactory()->createMarshaller($defaultValueElements->item(0),  array($object->getBaseType()));

                        $object->setDefaultValue($defaultValueMarshaller->unmarshall($defaultValueElement));
                    }

                    return $object;
                } else {
                    $msg = "The mandatory attribute 'cardinality' is missing from element '" . $element->localName . "'.";
                    throw new UnmarshallingException($msg, $element);
                }
            } else {
                $msg = "The mandatory attribute 'identifier' is missing from element '" . $element->localName . "'.";
                throw new UnmarshallingException($msg, $element);
            }
        } catch (InvalidArgumentException $e) {
            $msg = "An unexpected error occured while unmarshalling the variableDeclaration.";
            throw new UnmarshallingException($msg, $element, $e);
        }
    }