/**
  * builds the xml object with the passed TEST node and all of its children
  *
  * @param int $course_id the id of the course to export
  * @param string $nodeId the id of the node to export, in ADA format (e.g. xxx_yyy)
  * @param DOMDocument $domtree the XML object to append nodes to
  * @param AMATestDataHandler $dh_test the dataHandler used to retreive datas
  * @param DOMElement $XMLElement the element to append nodes to
  *
  * @access public
  */
 public function exportTestNodeChildren($course_id, $nodeId, &$domtree, &$dh_test, $XMLElement = null)
 {
     static $count = 0;
     $nodeInfo = $dh_test->test_getNode($nodeId);
     if (!AMA_DB::isError($nodeInfo)) {
         if (function_exists('memory_get_usage')) {
             $mem = memory_get_usage();
         } else {
             $mem = 'N/A';
         }
         $this->_logMessage(__METHOD__ . ' Exporting ADA TEST Node num. ' . $count++ . ' nodeId=' . $nodeId . ' memory_get_usage()=' . $mem);
         // 			$XMLElement =& $XMLElement->appendChild(self::buildTestXML($domtree, $nodeInfo));
         if (is_null($XMLElement)) {
             $this->testNodeXMLElement->appendChild(self::buildTestXML($domtree, $nodeInfo));
         } else {
             $XMLElement = $XMLElement->appendChild(self::buildTestXML($domtree, $nodeInfo));
         }
         $childrenNodesArr = $dh_test->test_getNodesByParent($nodeId, null, array('id_istanza' => 0));
         foreach ($childrenNodesArr as $childNode) {
             $this->exportTestNodeChildren($course_id, $childNode['id_nodo'], $domtree, $dh_test);
         }
     }
 }