protected function unmarshall(DOMElement $element)
    {
        // identifier is a mandatory value.
        if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier', 'string')) !== null) {
            if (($value = $this->getDOMElementAttributeAs($element, 'value', 'string')) !== null) {
                if (Format::isFloat($value)) {
                    try {
                        $object = new Weight($identifier, floatval($value));

                        return $object;
                    } catch (InvalidArgumentException $e) {
                        $msg = "The value of 'identifier' from element '" . $element->localName . "' is not a valid QTI Identifier.";
                        throw new UnmarshallingException($msg, $element, $e);
                    }
                } else {
                    $msg = "The value of attribute 'value' from element '" . $element->localName . "' cannot be converted into a float.";
                    throw new UnmarshallingException($msg, $element);
                }
            } else {
                $msg = "The mandatory attribute 'value' 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);
        }
    }