protected function unmarshall(DOMElement $element)
    {
        if (($baseType = $this->getDOMElementAttributeAs($element, 'baseType', 'string')) !== null) {

            $value = $element->nodeValue;
            $baseTypeCst = BaseType::getConstantByName($baseType);
            
            // A little bit of cleaning...
            if ($baseTypeCst !== BaseType::STRING) {
                $value = trim($value);
            }
            
            $object = new BaseValue($baseTypeCst, Utils::stringToDatatype($value, $baseTypeCst));

            return $object;
        } else {
            $msg = "The mandatory attribute 'baseType' is missing from element '" . $element->localName . "'.";
            throw new UnmarshallingException($msg, $element);
        }
    }
protected function unmarshall(DOMElement $element)
    {
        if (($baseType = $this->getDOMElementAttributeAs($element, 'baseType', 'string')) !== null) {

            $value = $element->nodeValue;
            $baseTypeCst = BaseType::getConstantByName($baseType);
            
            // A little bit of cleaning...
            if ($baseTypeCst !== BaseType::STRING) {
                $value = trim($value);
            }
            
            $object = new BaseValue($baseTypeCst, Utils::stringToDatatype($value, $baseTypeCst));

            return $object;
        } else {
            $msg = "The mandatory attribute 'baseType' is missing from element '" . $element->localName . "'.";
            throw new UnmarshallingException($msg, $element);
        }
    }
protected function unmarshall ( DOMElement $ element ) { if ( ( $ baseType = $ this -> getDOMElementAttributeAs ( $ element , 'baseType' , 'string' ) ) !== null ) { $ value = $ element -> nodeValue ; $ baseTypeCst = BaseType :: getConstantByName ( $ baseType ) ; // A little bit of cleaning... if ( $ baseTypeCst !== BaseType :: STRING ) { $ value = trim ( $ value ) ; } $ object = new BaseValue ( $ baseTypeCst , Utils :: stringToDatatype ( $ value , $ baseTypeCst ) ) ; return $ object ; } else { $ msg = "The mandatory attribute 'baseType' is missing from element '" . $ element -> localName . "'." ; throw new UnmarshallingException ( $ msg , $ element ) ; } }
Unmarshall a DOMElement object corresponding to a QTI baseValue element.

@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A BaseValue object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException
Unmarshall a DOMElement object corresponding to a QTI baseValue element .