Index: modules/importexportapi/engines/importexportapi_db_get.inc
===================================================================
--- modules/importexportapi/engines/importexportapi_db_get.inc	(revision 246)
+++ modules/importexportapi/engines/importexportapi_db_get.inc	(working copy)
@@ -17,6 +17,7 @@
 function importexportapi_db_get($def) {
   static $placeholder_map, $tables;
 
+  $skel_def = _importexport_api_get_skel_def ($def);
   $data = array();
 
   if (!isset($placeholder_map)) {
@@ -144,7 +145,7 @@
     $query_resource = db_query($sql, $args);
     while ($result = db_fetch_object($query_resource)) {
       if ($index == 0) {
-        $data[$count] = $def;
+        $data[$count] = $skel_def;
 
         foreach (element_children($data[$count]) as $field) {
           if ($data[$count][$field]['#type'] == 'array') {
@@ -155,9 +156,11 @@
           else {
             // Populate this top-level field with its value, or with the
             // default value for that field type if none was found.
-            $data[$count][$field]['#value'] = isset($result->$field) ? $result->$field : $data[$count][$field]['#default_value'];
+            $data[$count][$field]['#value'] = isset($result->$field) ? $result->$field : $def[$field]['#default_value'];
+	    $data[$count][$field]['#def'] = &$def[$field];
           }
         }
+	$data[$count]['#def'] = &$def;
 
         $count++;
       }
@@ -191,7 +194,7 @@
               // Recurse down to the correct level of nested arrays, and set
               // values within those arrays.
               $array_field = isset($query['parents'][0]) ? $query['parents'][0] : $query['field'];
-              _importexportapi_db_get_array_values($data[$data_index][$array_field], $field_count[$data_index], $query, $result);
+              _importexportapi_db_get_array_values($def[$array_field], $data[$data_index][$array_field], $field_count[$data_index], $query, $result);
             }
           }
         }
@@ -379,7 +382,7 @@
  *   Internal use only: leave at default value (NULL) when calling from other
  *   functions.
  */
-function _importexportapi_db_get_array_values(&$data, &$field_count, $query, $result, $parent_data = NULL, $parent_index = NULL) {
+function _importexportapi_db_get_array_values($def, &$data, &$field_count, $query, $result, $parent_data = NULL, $parent_index = NULL) {
   // Each time that this function calls itself, we check the top-level parent,
   // And pop it off the beginning of the array. By doing this, we recurse down
   // through the parents, until we reach the array itself.
@@ -394,7 +397,7 @@
   $next_parent = isset($query['parents'][0]) ? $query['parents'][0] : $query['field'];
   if (isset($parent_field) && !empty($data['#value'])) {
     foreach (element_children($data['#value']) as $index) {
-      _importexportapi_db_get_array_values($data['#value'][$index][$next_parent], $field_count, $query, $result, $data, $index);
+      _importexportapi_db_get_array_values($def[$next_parent], $data['#value'][$index][$next_parent], $field_count, $query, $result, $data, $index);
     }
   }
   else {
@@ -434,14 +437,17 @@
             $data['#value'][$field_count[$array_field]][$child_id] = $child;
           }
         }
+	$data['#value'][$field_count[$array_field]]['#def'] = &$def;
 
         // Populate this field with its value, within the corresponding
         // parent entity.
         foreach (element_children($data) as $child) {
           $child_info = $data['#value'][$field_count[$array_field]][$child];
-          $child_info_db_field = $child_info['#get']['#db_field'];
-          $child_info['#value'] = isset($result->$child_info_db_field) ? $result->$child_info_db_field : $child_info['#default_value'];
+          $child_info_db_field = $def[$child]['#get']['#db_field'];
 
+          $child_info['#value'] = isset($result->$child_info_db_field) ? $result->$child_info_db_field : $def[$child]['#default_value'];
+
+	  $child_info['#def'] = &$def[$child];
           $data['#value'][$field_count[$array_field]][$child] = $child_info;
         }
 
Index: modules/importexportapi/engines/importexportapi_xml_put.inc
===================================================================
--- modules/importexportapi/engines/importexportapi_xml_put.inc	(revision 246)
+++ modules/importexportapi/engines/importexportapi_xml_put.inc	(working copy)
@@ -18,28 +18,28 @@
 
   // Convert the structured data into an array in MiniXML format.
   foreach ($data as $entity) {
-    $put = $entity['#put'];
-    if (!isset($entity_count[$entity['#id']])) {
-      $entity_count[$entity['#id']] = 0;
+    $put = $entity['#def']['#put'];
+    if (!isset($entity_count[$entity['#def']['#id']])) {
+      $entity_count[$entity['#def']['#id']] = 0;
     }
 
     if (!isset($export[$put['#xml_plural']])) {
       $export[$put['#xml_plural']] = array();
       $export[$put['#xml_plural']][$put['#xml_mapping']] = array();
     }
-    $export[$put['#xml_plural']][$put['#xml_mapping']][$entity_count[$entity['#id']]] = array();
+    $export[$put['#xml_plural']][$put['#xml_mapping']][$entity_count[$entity['#def']['#id']]] = array();
 
     foreach (element_children($entity) as $field_index) {
       // Recurse down through children, and add all child values to the MiniXML
       // array.
-      _importexportapi_xml_put($export[$put['#xml_plural']][$put['#xml_mapping']][$entity_count[$entity['#id']]], $entity[$field_index], $use_cdata);
+      _importexportapi_xml_put($export[$put['#xml_plural']][$put['#xml_mapping']][$entity_count[$entity['#def']['#id']]], $entity[$field_index], $use_cdata);
     }
 
     if (empty($export[$put['#xml_plural']][$put['#xml_mapping']])) {
       unset($export[$put['#xml_plural']]);
     }
 
-    $entity_count[$entity['#id']]++;
+    $entity_count[$entity['#def']['#id']]++;
   }
 
   $export = array('drupal' => $export);
@@ -66,16 +66,16 @@
  *   The children of this field are recursively added as well.
  */
 function _importexportapi_xml_put(&$export, $field, $use_cdata) {
-  $put = $field['#put'];
+  $put = $field['#def']['#put'];
 
-  if ($field['#type'] != 'array') {
+  if ($field['#def']['#type'] != 'array') {
     if (isset($field['#value']) && $field['#value'] !== '' && empty($put['#xml_hidden'])) {
       if ($use_cdata && _importexportapi_xml_put_check_specialchars($field['#value'])) {
         _importexportapi_xml_put_wrap_cdata($field['#value']);
       }
 
       // Assign this field to the MiniXML array.
-      if ($field['#type'] == 'freeform') {
+      if ($field['#def']['#type'] == 'freeform') {
         $export[$put['#xml_plural']] = array($put['#xml_mapping'] => $field['#value']);
       }
       else {
@@ -91,8 +91,8 @@
       $export[$put['#xml_plural']][$put['#xml_mapping']][$child] = array();
       foreach (element_children($field['#value'][$child]) as $child_field) {
         $child_field_data = $field['#value'][$child][$child_field];
-        $put_child = $child_field_data['#put'];
-        if ($child_field_data['#type'] == 'array') {
+        $put_child = $child_field_data['#def']['#put'];
+        if ($child_field_data['#def']['#type'] == 'array') {
           // Recurse down through the children of this field.
           _importexportapi_xml_put($export[$put['#xml_plural']][$put['#xml_mapping']][$child], $child_field_data, $use_cdata);
         }
@@ -102,7 +102,7 @@
           }
 
           // Assign children of array fields to the MiniXML array.
-          if ($child_field_data['#type'] == 'freeform') {
+          if ($child_field_data['#def']['#type'] == 'freeform') {
             $export[$put['#xml_plural']][$put['#xml_mapping']][$child][$put_child['#xml_plural']] = array($put_child['#xml_mapping'] => $child_field_data['#value']);
           }
           else {
Index: modules/importexportapi/importexportapi.module
===================================================================
--- modules/importexportapi/importexportapi.module	(revision 245)
+++ modules/importexportapi/importexportapi.module	(working copy)
@@ -1014,3 +1014,43 @@
     }
   }
 }
+
+/**
+ * Function to get a skeletion definition which contains no properties but
+ * only the keys for all the children of the definition array. This can be 
+ * used to create data arrays that does not contain repetitive attibutes that
+ * are already present in the definitions array.
+ * 
+ * @param $def
+ *   The data definition array for an entity, as returned by
+ *   importexportapi_get_def().
+ * @return
+ *   A array similar to $def array but does not contain any property name
+ *   value pairs.
+ */
+function _importexport_api_get_skel_def ($def)
+{
+  $skel_def = $def;
+
+  _importexport_api_clean_def ($skel_def);
+
+  return $skel_def;
+}
+
+/**
+ * Helper function to _importexport_api_get_skel_def() that will remove all
+ * the property key-value pairse from a given defintions array recursively.
+ * 
+ * @param &$def
+ *   The definition array from which the property key-value pairs have to be
+ *   removed.
+ */
+function _importexport_api_clean_def (&$def)
+{
+  foreach ($def as $key => $value) { 
+    if (is_array ($def[$key]))
+      _importexport_api_clean_def ($def[$key]);
+    if (strncmp ($key, "#", 1) == 0)
+      unset ($def[$key]);
+  }
+}
