/** * Unmarshall a DOMElement object corresponding to an XHTML param element. * * @param \DOMElement $element A DOMElement object. * @return \qtism\data\QtiComponent A Param object. * @throws \qtism\data\storage\xml\marshalling\UnmarshallingException */ protected function unmarshall(DOMElement $element) { if (($name = self::getDOMElementAttributeAs($element, 'name')) === null) { // XSD use="required" but can be empty. $name = ''; } if (($value = self::getDOMElementAttributeAs($element, 'value')) === null) { // XSD use="required" but can be empty. $value = ''; } if (($valueType = self::getDOMElementAttributeAs($element, 'valuetype')) !== null) { $component = new Param($name, $value, ParamType::getConstantByName($valueType)); if (($type = self::getDOMElementAttributeAs($element, 'type')) !== null) { $component->setType($type); } return $component; } else { $msg = "The mandatory attribute 'valueType' is missing from the 'param' element."; throw new UnmarshallingException($msg, $element); } }