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);
        }
    }
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);
        }
    }
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 ) ; } }
Unmarshall a DOMElement object corresponding to a QTI weight element.

@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A Weight object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException If the mandatory attributes 'identifier' or 'value' are missing from $element but also if 'value' cannot be converted to a float value or 'identifier' is not a valid QTI Identifier.
Unmarshall a DOMElement object corresponding to a QTI weight element .