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

            $objectElts = $this->getChildElementsByTagName($element, 'object');
            if (count($objectElts) > 0) {

                $object = $this->getMarshallerFactory()->createMarshaller($objectElts[0])->unmarshall($objectElts[0]);

                $associableHotspotElts = $this->getChildElementsByTagName($element, 'associableHotspot');

                if (count($associableHotspotElts) > 0) {

                    $associableHotspots = new AssociableHotspotCollection();

                    foreach ($associableHotspotElts as $associableHotspotElt) {
                        $associableHotspots[] = $this->getMarshallerFactory()->createMarshaller($associableHotspotElt)->unmarshall($associableHotspotElt);
                    }

                    $gapImgElts = $this->getChildElementsByTagName($element, 'gapImg');

                    if (count($gapImgElts) > 0) {

                        $gapImgs = new GapImgCollection();

                        foreach ($gapImgElts as $gapImgElt) {
                            $gapImgs[] = $this->getMarshallerFactory()->createMarshaller($gapImgElt)->unmarshall($gapImgElt);
                        }

                        $component = new GraphicGapMatchInteraction($responseIdentifier, $object, $gapImgs, $associableHotspots);

                        $promptElts = $this->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);
                        }

                        $this->fillBodyElement($component, $element);

                        return $component;
                    } else {
                        $msg = "A 'graphicGapMatchInteraction' element must contain at least one 'gapImg' element, none given.";
                        throw new UnmarshallingException($msg, $element);
                    }

                } else {
                    $msg = "A 'graphiGapMatchInteraction' element must contain at least one 'associableHotspot' element, none given.";
                    throw new UnmarshallingException($msg, $element);
                }
            } else {
                $msg = "A 'graphicGapMatchInteraction' element must contain exactly one 'object' element, none given.";
                throw new UnmarshallingException($msg, $element);
            }
        } else {
            $msg = "The mandatory 'responseIdentifier' attribute is missing from the 'graphicGapMatchInteraction' element.";
            throw new UnmarshallingException($msg, $element);
        }
    }
protected function unmarshall(DOMElement $element)
    {
        if (($responseIdentifier = $this->getDOMElementAttributeAs($element, 'responseIdentifier')) !== null) {

            $objectElts = $this->getChildElementsByTagName($element, 'object');
            if (count($objectElts) > 0) {

                $object = $this->getMarshallerFactory()->createMarshaller($objectElts[0])->unmarshall($objectElts[0]);

                $associableHotspotElts = $this->getChildElementsByTagName($element, 'associableHotspot');

                if (count($associableHotspotElts) > 0) {

                    $associableHotspots = new AssociableHotspotCollection();

                    foreach ($associableHotspotElts as $associableHotspotElt) {
                        $associableHotspots[] = $this->getMarshallerFactory()->createMarshaller($associableHotspotElt)->unmarshall($associableHotspotElt);
                    }

                    $gapImgElts = $this->getChildElementsByTagName($element, 'gapImg');

                    if (count($gapImgElts) > 0) {

                        $gapImgs = new GapImgCollection();

                        foreach ($gapImgElts as $gapImgElt) {
                            $gapImgs[] = $this->getMarshallerFactory()->createMarshaller($gapImgElt)->unmarshall($gapImgElt);
                        }

                        $component = new GraphicGapMatchInteraction($responseIdentifier, $object, $gapImgs, $associableHotspots);

                        $promptElts = $this->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);
                        }

                        $this->fillBodyElement($component, $element);

                        return $component;
                    } else {
                        $msg = "A 'graphicGapMatchInteraction' element must contain at least one 'gapImg' element, none given.";
                        throw new UnmarshallingException($msg, $element);
                    }

                } else {
                    $msg = "A 'graphiGapMatchInteraction' element must contain at least one 'associableHotspot' element, none given.";
                    throw new UnmarshallingException($msg, $element);
                }
            } else {
                $msg = "A 'graphicGapMatchInteraction' element must contain exactly one 'object' element, none given.";
                throw new UnmarshallingException($msg, $element);
            }
        } else {
            $msg = "The mandatory 'responseIdentifier' attribute is missing from the 'graphicGapMatchInteraction' element.";
            throw new UnmarshallingException($msg, $element);
        }
    }
protected function unmarshall ( DOMElement $ element ) { if ( ( $ responseIdentifier = $ this -> getDOMElementAttributeAs ( $ element , 'responseIdentifier' ) ) !== null ) { $ objectElts = $ this -> getChildElementsByTagName ( $ element , 'object' ) ; if ( count ( $ objectElts ) > 0 ) { $ object = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ objectElts [ 0 ] ) -> unmarshall ( $ objectElts [ 0 ] ) ; $ associableHotspotElts = $ this -> getChildElementsByTagName ( $ element , 'associableHotspot' ) ; if ( count ( $ associableHotspotElts ) > 0 ) { $ associableHotspots = new AssociableHotspotCollection ( ) ; foreach ( $ associableHotspotElts as $ associableHotspotElt ) { $ associableHotspots [ ] = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ associableHotspotElt ) -> unmarshall ( $ associableHotspotElt ) ; } $ gapImgElts = $ this -> getChildElementsByTagName ( $ element , 'gapImg' ) ; if ( count ( $ gapImgElts ) > 0 ) { $ gapImgs = new GapImgCollection ( ) ; foreach ( $ gapImgElts as $ gapImgElt ) { $ gapImgs [ ] = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ gapImgElt ) -> unmarshall ( $ gapImgElt ) ; } $ component = new GraphicGapMatchInteraction ( $ responseIdentifier , $ object , $ gapImgs , $ associableHotspots ) ; $ promptElts = $ this -> 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 ) ; } $ this -> fillBodyElement ( $ component , $ element ) ; return $ component ; } else { $ msg = "A 'graphicGapMatchInteraction' element must contain at least one 'gapImg' element, none given." ; throw new UnmarshallingException ( $ msg , $ element ) ; } } else { $ msg = "A 'graphiGapMatchInteraction' element must contain at least one 'associableHotspot' element, none given." ; throw new UnmarshallingException ( $ msg , $ element ) ; } } else { $ msg = "A 'graphicGapMatchInteraction' element must contain exactly one 'object' element, none given." ; throw new UnmarshallingException ( $ msg , $ element ) ; } } else { $ msg = "The mandatory 'responseIdentifier' attribute is missing from the 'graphicGapMatchInteraction' element." ; throw new UnmarshallingException ( $ msg , $ element ) ; } }
Unmarshall a DOMElement object corresponding to a graphicGapMatchInteraction element.

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