protected function appendChildren(DOMDocumentFragment $fragment, QtiComponent $component, $base = '') { try { $dom = $component->getXml(); $node = $fragment->ownerDocument->importNode($dom->documentElement, true); $fragment->appendChild($node); } catch (RuntimeException $e) { $msg = "An error occured while rendering the XML content of the '" . $component->getQtiClassName() . "' external component."; throw new RenderingException($msg, RenderingException::UNKNOWN, $e); } }
protected function appendChildren(DOMDocumentFragment $fragment, QtiComponent $component, $base = '') { try { $dom = $component->getXml(); $node = $fragment->ownerDocument->importNode($dom->documentElement, true); $node = Utils::anonimizeElement($node); $node->setAttribute('xmlns', 'http://www.w3.org/1998/Math/MathML'); $fragment->appendChild($node); } catch (RuntimeException $e) { $msg = "An error occured while rendering the XML content of the 'MathML' external component."; throw new RenderingException($msg, RenderingException::UNKNOWN, $e); } }
/** * @see \qtism\runtime\rendering\markup\xhtml\ExternalQtiComponentRenderer::appendChildren() */ protected function appendChildren(DOMDocumentFragment $fragment, QtiComponent $component, $base = '') { try { $dom = $component->getXml(); $node = $fragment->ownerDocument->importNode($dom->documentElement, true); $nodeNamespaceUri = $node->namespaceURI; $node = Utils::anonimizeElement($node); if ($this->mustNamespaceOutput() === true) { $node->setAttribute('xmlns', $nodeNamespaceUri); } $fragment->appendChild($node); } catch (RuntimeException $e) { $msg = "An error occured while rendering the XML content of the 'MathML' external component."; throw new RenderingException($msg, RenderingException::UNKNOWN, $e); } }
/** * @see \qtism\data\storage\xml\marshalling\RecursiveMarshaller::marshallChildrenKnown() */ protected function marshallChildrenKnown(QtiComponent $component, array $elements) { $element = self::getDOMCradle()->createElement($component->getQtiClassName()); foreach ($elements as $elt) { $element->appendChild($elt); } if ($component instanceof CustomOperator) { if ($component->hasClass() === true) { self::setDOMElementAttribute($element, 'class', $component->getClass()); } if ($component->hasDefinition() === true) { self::setDOMElementAttribute($element, 'definition', $component->getDefinition()); } // Now, we have to extract the LAX content of the custom operator and put it into // what we are putting out. (It is possible to have no LAX content at all, it is not mandatory). $xml = $component->getXml(); $operatorElt = $xml->documentElement->cloneNode(true); $qtiOperatorElts = self::getChildElementsByTagName($operatorElt, array_merge(self::getOperators(), self::getExpressions())); foreach ($qtiOperatorElts as $qtiOperatorElt) { $operatorElt->removeChild($qtiOperatorElt); } Utils::importChildNodes($operatorElt, $element); Utils::importAttributes($operatorElt, $element); } return $element; }
/** * Marshall a Math object into a DOMElement object. * * @param QtiComponent $component A Math object. * @return DOMElement The according DOMElement object. * @throws MarshallingException */ protected function marshall(QtiComponent $component) { return self::getDOMCradle()->importNode($component->getXml()->documentElement, true); }