/** * Unmarshall a DOMElement object corresponding to a DrawingInteraction element. * * @param DOMElement $element A DOMElement object. * @return QtiComponent A DrawingInteraction object. * @throws UnmarshallingException */ protected function unmarshall(DOMElement $element) { if (($responseIdentifier = self::getDOMElementAttributeAs($element, 'responseIdentifier')) !== null) { $objectElts = self::getChildElementsByTagName($element, 'object'); if (count($objectElts) > 0) { $objectElt = $objectElts[0]; $object = $this->getMarshallerFactory()->createMarshaller($objectElt)->unmarshall($objectElt); $component = new DrawingInteraction($responseIdentifier, $object); $promptElts = self::getChildElementsByTagName($element, 'prompt'); if (count($promptElts) > 0) { $promptElt = $promptElts[0]; $prompt = $this->getMarshallerFactory()->createMarshaller($promptElt)->unmarshall($promptElt); $component->setPrompt($prompt); } if (($xmlBase = self::getXmlBase($element)) !== false) { $component->setXmlBase($xmlBase); } self::fillBodyElement($component, $element); return $component; } else { $msg = "A 'drawingInteraction' element must contain exactly one 'object' element, none given."; throw new UnmarshallingException($msg, $element); } } else { $msg = "The mandatory 'responseIdentifier' attribute is missing from the 'drawingInteraction' element."; throw new UnmarshallingException($msg, $element); } }