/**
  * 
  * 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;
 }