本文整理匯總了PHP中XenForo_Helper_DevelopmentXml::createDomElement方法的典型用法代碼示例。如果您正苦於以下問題:PHP XenForo_Helper_DevelopmentXml::createDomElement方法的具體用法?PHP XenForo_Helper_DevelopmentXml::createDomElement怎麽用?PHP XenForo_Helper_DevelopmentXml::createDomElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XenForo_Helper_DevelopmentXml
的用法示例。
在下文中一共展示了XenForo_Helper_DevelopmentXml::createDomElement方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: renderXml
public function renderXml()
{
$document = new DOMDocument('1.0', 'utf-8');
$document->formatOutput = true;
$rootNode = $document->createElement('errors');
$document->appendChild($rootNode);
if (isset($this->_params['exception']) && $this->_params['exception'] instanceof Exception) {
$e = $this->_params['exception'];
$exceptionMessage = $e->getMessage();
$rootNode->appendChild(XenForo_Helper_DevelopmentXml::createDomElement($document, 'error', $exceptionMessage));
$traceNode = $document->createElement('trace');
foreach ($e->getTrace() as $trace) {
$function = (isset($trace['class']) ? $trace['class'] . $trace['type'] : '') . $trace['function'];
if (!isset($trace['file'])) {
$trace['file'] = '';
}
if (!isset($trace['line'])) {
$trace['line'] = '';
}
$entryNode = $document->createElement('entry');
$entryNode->setAttribute('function', $function);
$entryNode->setAttribute('file', $trace['file']);
$entryNode->setAttribute('line', $trace['line']);
$traceNode->appendChild($entryNode);
}
$rootNode->appendChild($traceNode);
} else {
$rootNode->appendChild($document->createElement('error', 'Unknown error, trace unavailable'));
}
return $document->saveXML();
}