/** * Fix erroneously self-closing elements * * @return string */ public function getBody() { return $this->fixNonvoidTags(parent::getBody()); }
protected function parseContainerInteractive(DOMElement $data, ContainerInteractive $container) { $bodyElements = array(); //parse the xml to find the interaction nodes $interactionNodes = $this->queryXPath(".//*[not(ancestor::feedbackBlock) and not(ancestor::feedbackInline) and contains(name(.), 'Interaction')]", $data); foreach ($interactionNodes as $k => $interactionNode) { if (strpos($interactionNode->nodeName, 'portableCustomInteraction') === false) { //build an interaction instance $interaction = $this->buildInteraction($interactionNode); if (!is_null($interaction)) { $bodyElements[$interaction->getSerial()] = $interaction; $this->replaceNode($interactionNode, $interaction); } } } //parse for feedback elements interactive! $feedbackNodes = $this->queryXPath(".//*[not(ancestor::feedbackBlock) and not(ancestor::feedbackInline) and contains(name(.), 'feedback')]", $data); foreach ($feedbackNodes as $feedbackNode) { $feedback = $this->buildFeedback($feedbackNode, true); if (!is_null($feedback)) { $bodyElements[$feedback->getSerial()] = $feedback; $this->replaceNode($feedbackNode, $feedback); } } $bodyData = $this->getBodyData($data); foreach ($bodyElements as $bodyElement) { if (strpos($bodyData, $bodyElement->getPlaceholder()) === false) { unset($bodyElements[$bodyElement->getSerial()]); } } if (!$container->setElements($bodyElements, $bodyData)) { throw new ParsingException('Cannot set elements to the interactive container'); } return $this->parseContainerStatic($data, $container); }