本文整理汇总了PHP中qtism\data\QtiComponent::getXml方法的典型用法代码示例。如果您正苦于以下问题:PHP QtiComponent::getXml方法的具体用法?PHP QtiComponent::getXml怎么用?PHP QtiComponent::getXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtism\data\QtiComponent
的用法示例。
在下文中一共展示了QtiComponent::getXml方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: appendChildren
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);
}
}
示例2: appendChildren
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);
}
}
示例3: appendChildren
/**
* @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);
}
}
示例4: marshallChildrenKnown
/**
* @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;
}
示例5: marshall
/**
* 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);
}