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

            $object = new SectionPart($identifier);

            if (($required = $this->getDOMElementAttributeAs($element, 'required', 'boolean')) !== null) {
                $object->setRequired($required);
            }

            if (($fixed = $this->getDOMElementAttributeAs($element, 'fixed', 'boolean')) !== null) {
                $object->setFixed($fixed);
            }

            $preConditionElts = $this->getChildElementsByTagName($element, 'preCondition');
            if (count($preConditionElts) > 0) {
                $preConditions = new PreConditionCollection();
                for ($i = 0; $i < count($preConditionElts); $i++) {
                    $marshaller = $this->getMarshallerFactory()->createMarshaller($preConditionElts[$i]);
                    $preConditions[] = $marshaller->unmarshall($preConditionElts[$i]);
                }
                $object->setPreConditions($preConditions);
            }

            $branchRuleElts = $this->getChildElementsByTagName($element, 'branchRule');
            if (count($branchRuleElts) > 0) {
                $branchRules = new BranchRuleCollection();
                for ($i = 0; $i < count($branchRuleElts); $i++) {
                    $marshaller = $this->getMarshallerFactory()->createMarshaller($branchRuleElts[$i]);
                    $branchRules[] = $marshaller->unmarshall($branchRuleElts[$i]);
                }
                $object->setBranchRules($branchRules);
            }

            $itemSessionControlElts = $this->getChildElementsByTagName($element, 'itemSessionControl');
            if (count($itemSessionControlElts) == 1) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($itemSessionControlElts[0]);
                $object->setItemSessionControl($marshaller->unmarshall($itemSessionControlElts[0]));
            }

            $timeLimitsElts = $this->getChildElementsByTagName($element, 'timeLimits');
            if (count($timeLimitsElts) == 1) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($timeLimitsElts[0]);
                $object->setTimeLimits($marshaller->unmarshall($timeLimitsElts[0]));
            }

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

            $object = new SectionPart($identifier);

            if (($required = $this->getDOMElementAttributeAs($element, 'required', 'boolean')) !== null) {
                $object->setRequired($required);
            }

            if (($fixed = $this->getDOMElementAttributeAs($element, 'fixed', 'boolean')) !== null) {
                $object->setFixed($fixed);
            }

            $preConditionElts = $this->getChildElementsByTagName($element, 'preCondition');
            if (count($preConditionElts) > 0) {
                $preConditions = new PreConditionCollection();
                for ($i = 0; $i < count($preConditionElts); $i++) {
                    $marshaller = $this->getMarshallerFactory()->createMarshaller($preConditionElts[$i]);
                    $preConditions[] = $marshaller->unmarshall($preConditionElts[$i]);
                }
                $object->setPreConditions($preConditions);
            }

            $branchRuleElts = $this->getChildElementsByTagName($element, 'branchRule');
            if (count($branchRuleElts) > 0) {
                $branchRules = new BranchRuleCollection();
                for ($i = 0; $i < count($branchRuleElts); $i++) {
                    $marshaller = $this->getMarshallerFactory()->createMarshaller($branchRuleElts[$i]);
                    $branchRules[] = $marshaller->unmarshall($branchRuleElts[$i]);
                }
                $object->setBranchRules($branchRules);
            }

            $itemSessionControlElts = $this->getChildElementsByTagName($element, 'itemSessionControl');
            if (count($itemSessionControlElts) == 1) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($itemSessionControlElts[0]);
                $object->setItemSessionControl($marshaller->unmarshall($itemSessionControlElts[0]));
            }

            $timeLimitsElts = $this->getChildElementsByTagName($element, 'timeLimits');
            if (count($timeLimitsElts) == 1) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($timeLimitsElts[0]);
                $object->setTimeLimits($marshaller->unmarshall($timeLimitsElts[0]));
            }

            return $object;
        } else {
            $msg = "The mandatory attribute 'identifier' is missing from element '" . $element->localName . "'.";
            throw new UnmarshallingException($msg, $element);
        }
    }
protected function unmarshall ( DOMElement $ element ) { if ( ( $ identifier = $ this -> getDOMElementAttributeAs ( $ element , 'identifier' ) ) !== null ) { $ object = new SectionPart ( $ identifier ) ; if ( ( $ required = $ this -> getDOMElementAttributeAs ( $ element , 'required' , 'boolean' ) ) !== null ) { $ object -> setRequired ( $ required ) ; } if ( ( $ fixed = $ this -> getDOMElementAttributeAs ( $ element , 'fixed' , 'boolean' ) ) !== null ) { $ object -> setFixed ( $ fixed ) ; } $ preConditionElts = $ this -> getChildElementsByTagName ( $ element , 'preCondition' ) ; if ( count ( $ preConditionElts ) > 0 ) { $ preConditions = new PreConditionCollection ( ) ; for ( $ i = 0 ; $ i < count ( $ preConditionElts ) ; $ i ++ ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ preConditionElts [ $ i ] ) ; $ preConditions [ ] = $ marshaller -> unmarshall ( $ preConditionElts [ $ i ] ) ; } $ object -> setPreConditions ( $ preConditions ) ; } $ branchRuleElts = $ this -> getChildElementsByTagName ( $ element , 'branchRule' ) ; if ( count ( $ branchRuleElts ) > 0 ) { $ branchRules = new BranchRuleCollection ( ) ; for ( $ i = 0 ; $ i < count ( $ branchRuleElts ) ; $ i ++ ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ branchRuleElts [ $ i ] ) ; $ branchRules [ ] = $ marshaller -> unmarshall ( $ branchRuleElts [ $ i ] ) ; } $ object -> setBranchRules ( $ branchRules ) ; } $ itemSessionControlElts = $ this -> getChildElementsByTagName ( $ element , 'itemSessionControl' ) ; if ( count ( $ itemSessionControlElts ) == 1 ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ itemSessionControlElts [ 0 ] ) ; $ object -> setItemSessionControl ( $ marshaller -> unmarshall ( $ itemSessionControlElts [ 0 ] ) ) ; } $ timeLimitsElts = $ this -> getChildElementsByTagName ( $ element , 'timeLimits' ) ; if ( count ( $ timeLimitsElts ) == 1 ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ timeLimitsElts [ 0 ] ) ; $ object -> setTimeLimits ( $ marshaller -> unmarshall ( $ timeLimitsElts [ 0 ] ) ) ; } return $ object ; } 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 sectionPart element.

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