本文整理汇总了PHP中kXml::appendDomToElement方法的典型用法代码示例。如果您正苦于以下问题:PHP kXml::appendDomToElement方法的具体用法?PHP kXml::appendDomToElement怎么用?PHP kXml::appendDomToElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kXml
的用法示例。
在下文中一共展示了kXml::appendDomToElement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toXML
/**
*
* Returns the test cases failures as a DomDocument
* @throws Exception
* @return DomDocument
*/
public static function toXML(KalturaTestCaseFailures $testCaseFailures, $rootNodeName = 'data')
{
if (count($testCaseFailures->getTestProceduresFailures()) == 0) {
return "";
}
$dom = new DOMDocument("1.0");
//Create elements in the Dom referencing the entire test data file
$testCaseElement = $dom->createElement($rootNodeName);
$testCaseElement->setAttribute("testCaseName", $testCaseFailures->getTestCaseName());
$dom->appendChild($testCaseElement);
//For each test data
foreach ($testCaseFailures->getTestProceduresFailures() as $testProcedureFailure) {
//Create the xml from the object
$objectAsDOM = KalturaTestProcedureFailure::toXml($testProcedureFailure, "TestProcedureFailures");
kXml::appendDomToElement($objectAsDOM, $testCaseElement, $dom);
}
return $dom;
}
示例2: toXml
/**
*
* Returns the given KalturaTestCaseInstanceData as a DomDocument
* @param KalturaTestCaseInstanceData $testCaseInstanceData
*/
public static function toXml(KalturaTestCaseInstanceData $testCaseInstanceData)
{
$dom = new DOMDocument("1.0");
//Create all his elements
$domTestCaseData = $dom->createElement("TestCaseData");
$domTestCaseData->setAttribute("testCaseInstanceName", $testCaseInstanceData->getTestCaseInstanceName());
$dom->appendChild($domTestCaseData);
//For each input:
foreach ($testCaseInstanceData->getInput() as $input) {
//Create the xml from the object
$objectAsDOM = KalturaTestDataObject::toXml($input, "Input");
kXml::appendDomToElement($objectAsDOM, $domTestCaseData, $dom);
}
//For each outputReference:
foreach ($testCaseInstanceData->getOutputReferences() as $outputReference) {
//Create the xml from the object
$objectAsDOM = KalturaTestDataObject::toXml($outputReference, "OutputReference");
kXml::appendDomToElement($objectAsDOM, $domTestCaseData, $dom);
}
return $dom;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:26,代码来源:KalturaTestCaseInstanceData.php
示例3: toXml
/**
*
* Returns the given KalturaTestDataFile as DomDocument
* @param KalturaTestDataFile $testDataFile
*/
public static function toXml(KalturaTestCaseDataFile $testDataFile)
{
$dom = new DOMDocument("1.0");
//Create elements in the Dom referencing the entire test data file
$testCaseDataElement = $dom->createElement("TestCaseData");
$testCaseDataElement->setAttribute("testCaseName", $testDataFile->getTestCaseName());
$dom->appendChild($testCaseDataElement);
//For each test procedure data
foreach ($testDataFile->getTestProceduresData() as $testProcedureData) {
$domTestProcedureData = KalturaTestProcedureData::toXml($testProcedureData);
kXml::appendDomToElement($domTestProcedureData, $testCaseDataElement, $dom);
}
return $dom;
}
示例4: toXml
/**
*
* Returns a DomDocument containing the test case failure
* @param KalturaTestCaseInstanceFailure $failure
* @param string $rootNodeName - default to 'data'
* @return DOMDocument - the xml for the given error
*/
public static function toXml(KalturaTestCaseInstanceFailure $testCaseInstanceFailure, $rootNodeName = 'data')
{
if (count($testCaseInstanceFailure->getFailures()) == 0) {
return new DOMDocument("1.0");
}
$dom = new DOMDocument(1.0);
$rootNode = $dom->createElement($rootNodeName);
$dom->appendChild($rootNode);
$rootNode->setAttribute("testCaseInstanceName", $testCaseInstanceFailure->getTestCaseInstanceName());
$inputsNode = $dom->createElement("Inputs");
foreach ($testCaseInstanceFailure->getTestCaseInput() as $inputKey => $inputValue) {
$node = $dom->createElement("Input");
if ($inputValue != null) {
$type = gettype($inputValue);
if (is_object($inputValue)) {
$class = get_class($inputValue);
KalturaLog::debug("class [" . $class . "]\n");
if (class_exists($class)) {
$type = get_class($inputValue);
}
}
$node->setAttribute("type", $type);
$id = $inputValue;
if ($inputValue instanceof BaseObject) {
$id = $inputValue->getId();
} elseif ($inputValue instanceof KalturaObjectBase || $inputValue instanceof KalturaObject) {
if (property_exists($inputValue, 'id')) {
$id = $inputValue->id;
}
}
//Fixes problem where id was object
if (is_object($id)) {
$idType = get_class($id);
$id = "not a string but {$idType}";
}
$node->setAttribute($type . "Id", $id);
}
$inputsNode->appendChild($node);
}
$failuresNode = $dom->createElement("Failures");
foreach ($testCaseInstanceFailure->getFailures() as $kalturaFailure) {
$objectAsDOM = KalturaFailure::toXml($kalturaFailure, "Failure");
kXml::appendDomToElement($objectAsDOM, $failuresNode, $dom);
}
$rootNode->appendChild($inputsNode);
$rootNode->appendChild($failuresNode);
//pass back DomElement object
return $dom;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:56,代码来源:KalturaTestCaseInstanceFailure.php
示例5: toXml
/**
*
* Returns the given KalturaTestProcedureData as a DomDocument
* @param KalturaTestProcedureData $testProcedureData
*/
public static function toXml(KalturaTestProcedureData $testProcedureData)
{
$dom = new DOMDocument("1.0");
$testProcedureDataElement = $dom->createElement("TestProcedureData");
$testProcedureDataElement->setAttribute("testProcedureName", $testProcedureData->getProcedureName());
$dom->appendChild($testProcedureDataElement);
foreach ($testProcedureData->getTestCasesData() as $testCaseData) {
$domTestCaseData = KalturaTestCaseInstanceData::toXml($testCaseData);
kXml::appendDomToElement($domTestCaseData, $testProcedureDataElement, $dom);
}
return $dom;
}