diff --git a/translators/file/tmgmt_file.format.xliff.inc b/translators/file/tmgmt_file.format.xliff.inc
index 88b0556..a617c3b 100644
--- a/translators/file/tmgmt_file.format.xliff.inc
+++ b/translators/file/tmgmt_file.format.xliff.inc
@@ -98,7 +98,7 @@ class TMGMTFileformatXLIFF extends XMLWriter implements TMGMTFileFormatInterface
     $this->writeAttribute('xml:lang', $this->job->getTranslator()->mapToRemoteLanguage($this->job->source_language));
 
     if ($job->getSetting('xliff_processing')) {
-      $this->writeRaw($this->processForExport($element['#text'], $key_array[0], $job));
+      $this->writeRaw($this->processForExport($element['#text'], $key_array));
     }
     else {
       $this->text($element['#text']);
@@ -111,7 +111,7 @@ class TMGMTFileformatXLIFF extends XMLWriter implements TMGMTFileFormatInterface
     $target = (!empty($element['#translation']['#text']) ? $element['#translation']['#text'] : $element['#text']);
 
     if ($job->getSetting('xliff_processing')) {
-      $this->writeRaw($this->processForExport($target, $key_array[0], $job));
+      $this->writeRaw($this->processForExport($target, $key_array));
     }
     else {
       $this->text($element['#text']);
@@ -240,7 +240,7 @@ class TMGMTFileformatXLIFF extends XMLWriter implements TMGMTFileFormatInterface
     }
 
     $reader = new XMLReader();
-    $elements_counts = $job->getSetting('elements_counts');
+    $xliff_validation = $job->getSetting('xliff_validation');
 
     foreach ($targets as $id => $target) {
       $count = 0;
@@ -252,10 +252,9 @@ class TMGMTFileformatXLIFF extends XMLWriter implements TMGMTFileFormatInterface
         $count++;
       }
 
-      $keys_array = tmgmt_ensure_keys_array($id);
-      $tjiid = array_shift($keys_array);
-      if (!isset($elements_counts[$tjiid]) || $elements_counts[$tjiid] != $count) {
-        return FALSE;
+      if (!isset($xliff_validation[$id]) || $xliff_validation[$id] != $count) {
+        $job->addMessage('Failed to validate semantic integrity of %key element. Please check also the HTML code of the element in the review process.',
+          array('%key' => $id));
       }
     }
 
@@ -347,12 +346,14 @@ class TMGMTFileformatXLIFF extends XMLWriter implements TMGMTFileFormatInterface
    *
    * @param string $source
    *   Job data array.
-   * @param int $tjiid
-   *   Job item ID.
+   * @param array $key_array
+   *   The source item data key.
    *
    * @return string
    */
-  protected function processForExport($source, $tjiid) {
+  protected function processForExport($source, array $key_array) {
+    $tjiid = $key_array[0];
+    $key_string = tmgmt_ensure_keys_string($key_array);
     // The reason why we use DOMDocument object here and not just XMLReader
     // is the DOMDocument's ability to deal with broken HTML.
     $dom = new DOMDocument();
@@ -371,7 +372,11 @@ class TMGMTFileformatXLIFF extends XMLWriter implements TMGMTFileFormatInterface
 
     $tray = array();
     $non_pair_tags = array('br', 'img');
-    $elements_count = 0;
+
+    if (!isset($this->job->settings['xliff_validation'])) {
+      $this->job->settings['xliff_validation'] = array();
+    }
+    $xliff_validation = &$this->job->settings['xliff_validation'];
 
     /** @var DOMElement $node */
     foreach ($iterator as $node) {
@@ -382,8 +387,11 @@ class TMGMTFileformatXLIFF extends XMLWriter implements TMGMTFileFormatInterface
 
       if ($node->nodeType === XML_ELEMENT_NODE) {
         // Increment the elements count and compose element id.
-        $elements_count++;
-        $id = 'tjiid' . $tjiid . '-' . $elements_count;
+        if (!isset($xliff_validation[$key_string])) {
+          $xliff_validation[$key_string] = 0;
+        }
+        $xliff_validation[$key_string]++;
+        $id = 'tjiid' . $tjiid . '-' . $xliff_validation[$key_string];
 
         $is_pair_tag = !in_array($node->nodeName, $non_pair_tags);
 
@@ -423,7 +431,7 @@ class TMGMTFileformatXLIFF extends XMLWriter implements TMGMTFileFormatInterface
         // add the end pair tag markup.
         if ($_info['value'] == $_info['built_text'] && $_info['is_pair_tag']) {
           // Count also for the closing elements.
-          $elements_count++;
+          $xliff_validation[$key_string]++;
           $this->writeEPT($writer, $_info['name'], $_info['id']);
           // When the end pair tag has been written unset the element info
           // from the tray.
@@ -432,8 +440,8 @@ class TMGMTFileformatXLIFF extends XMLWriter implements TMGMTFileFormatInterface
       }
     }
 
-    // Set the elements count for the current item into job settings.
-    $this->job->settings['elements_counts'][$tjiid] = $elements_count;
+    // Set the xliff_validation data that were set into the
+    // $this->job->settings['xliff_validation'] array().
     $this->job->save();
 
     $writer->endElement();
diff --git a/translators/file/tmgmt_file.test b/translators/file/tmgmt_file.test
index 6f6aca4..15ef3c7 100644
--- a/translators/file/tmgmt_file.test
+++ b/translators/file/tmgmt_file.test
@@ -120,31 +120,25 @@ class TMGMTFileTestCase extends TMGMTBaseTestCase {
     $integrity_check_failed = FALSE;
     /** @var TMGMTMessage $message */
     foreach ($job->getMessages() as $message) {
-      if ($message->getMessage() == t('Failed to validate file, import aborted.')) {
+      debug($message->getMessage());
+      if ($message->getMessage() == t('Failed to validate semantic integrity of %key element. Please check also the HTML code of the element in the review process.', array('%key' => '2][dummy][deep_nesting'))) {
         $integrity_check_failed = TRUE;
+        break;
       }
     }
     // We must have the message that integrity check failed.
-    $this->assertTrue($integrity_check_failed);
-
-    $job_items = $job->getItems();
-    /** @var TMGMTJobItem $job_item */
-    $job_item = array_shift($job_items);
-    // Job item must be in active state => translation not imported.
-    $this->assertTrue($job_item->isActive());
+    $this->assertTrue($integrity_check_failed, 'The validation of semantic integrity must fail.');
 
     // Set the XLIFF processing to FALSE and test it results in the source
     // text not being XLIFF processed.
     $translator->settings['xliff_processing'] = FALSE;
     $translator->save();
     $job = $this->createJob();
+    $job->translator = $translator->name;
     $job->addItem('test_html_source', 'test', '1');
     $job->requestTranslation();
-    $items = $job->getItems();
-    /** @var TMGMTJobItem $item */
-    $item = reset($items);
-    $data = $item->getData();
-    $this->assertEqual(trim($data['dummy']['deep_nesting']['#text']), $source_text);
+    $targets = $this->getTransUnitsContent($job);
+    $this->assertEqual(trim(html_entity_decode($targets['0']['target'])), $source_text);
   }
 
   /**
@@ -273,8 +267,8 @@ class TMGMTFileTestCase extends TMGMTBaseTestCase {
     $second_job->translator = $translator->name;
     // We need to add the elements count value into settings, otherwise the
     // validation will fail on integrity check.
-    $second_job->settings['elements_counts'][1] = 0;
-    $second_job->settings['elements_counts'][2] = 0;
+    $second_job->settings['xliff_validation'][1] = 0;
+    $second_job->settings['xliff_validation'][2] = 0;
     $second_job->save();
     $wrong_xml->file->header->{'phase-group'}->phase['job-id'] = $second_job->tjid;
     $wrong_file = 'public://tmgmt_file/wrong_file.xlf';
