Index: importexportapi.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/importexportapi.info,v
retrieving revision 1.3
diff -u -p -r1.3 importexportapi.info
--- importexportapi.info	25 Mar 2007 21:21:47 -0000	1.3
+++ importexportapi.info	17 Apr 2009 02:09:00 -0000
@@ -2,3 +2,4 @@
 name = Import Export API
 description = Allows data entities in Drupal to be imported and exported in a variety of formats.
 package = Import Export API
+core = 6.x
Index: importexportapi.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/importexportapi.install,v
retrieving revision 1.5
diff -u -p -r1.5 importexportapi.install
--- importexportapi.install	5 Nov 2006 07:03:29 -0000	1.5
+++ importexportapi.install	17 Apr 2009 02:09:01 -0000
@@ -11,103 +11,122 @@
  * Implementation of hook_install().
  */
 function importexportapi_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query('CREATE TABLE {importexportapi_db_put_map} (
-        put_map_id int(10) NOT NULL auto_increment,
-        put_id int(10) NOT NULL default \'0\',
-        entity varchar(255) NOT NULL default \'\',
-        field varchar(255) NOT NULL default \'\',
-        value_old int(10) NOT NULL default \'0\',
-        value_new int(10) NOT NULL default \'0\',
-        PRIMARY KEY (put_map_id),
-        KEY (put_id)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */
-      ');
-      db_query('CREATE TABLE {importexportapi_db_put_map_alt} (
-        put_map_alt_id int(10) NOT NULL auto_increment,
-        put_id int(10) NOT NULL default \'0\',
-        entity varchar(255) NOT NULL default \'\',
-        field varchar(255) NOT NULL default \'\',
-        alt_field varchar(255) NOT NULL default \'\',
-        value_alt varchar(255) NOT NULL default \'\',
-        value_key int(10) NOT NULL default \'0\',
-        PRIMARY KEY (put_map_alt_id),
-        KEY (put_id)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */
-      ');
-      break;
-    case 'pgsql':
-      db_query('CREATE TABLE {importexportapi_db_put_map} (
-        put_map_id SERIAL,
-        put_id integer NOT NULL default \'0\',
-        entity varchar(255) NOT NULL default \'\',
-        field varchar(255) NOT NULL default \'\',
-        value_old integer NOT NULL default \'0\',
-        value_new integer NOT NULL default \'0\',
-        PRIMARY KEY (put_map_id)
-        )
-      ');
-      db_query('CREATE INDEX {importexportapi_db_put_map}_put_id_idx
-        ON {importexportapi_db_put_map} (put_id)
-      ');
-      db_query('CREATE TABLE {importexportapi_db_put_map_alt} (
-        put_map_alt_id SERIAL,
-        put_id integer NOT NULL default \'0\',
-        entity varchar(255) NOT NULL default \'\',
-        field varchar(255) NOT NULL default \'\',
-        alt_field varchar(255) NOT NULL default \'\',
-        value_alt varchar(255) NOT NULL default \'\',
-        value_key integer NOT NULL default \'0\',
-        PRIMARY KEY (put_map_alt_id)
-        )
-      ');
-      db_query('CREATE INDEX {importexportapi_db_put_map_alt}_put_id_idx
-        ON {importexportapi_db_put_map_alt} (put_id)
-      ');
+  // Create tables
+  drupal_install_schema('importexportapi');
+  //drupal_install_schema('importexportapi_db_put_map');
+  //drupal_install_schema('importexportapi_db_put_map_alt');
+}
+
+/**
+ * Implementation of hook_install().
+ */
+function importexportapi_uninstall() {
+  // Drop tables
+   drupal_uninstall_schema('importexportapi');
+  //drupal_uninstall_schema('importexportapi_db_put_map');
+  //drupal_uninstall_schema('importexportapi_db_put_map_alt');
+}
+
 
-      break;
-  }
+/**
+ * Implementation of hook_schema().
+ */
+function importexportapi_schema() {
+  $schema['importexportapi_db_put_map'] = array(
+    'fields' => array(
+      'put_map_id' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'auto_increment'),
+      'put_id' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      'entity' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => ''),
+      'field' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => ''),
+      'value_old' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      'value_new' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0)
+    ),
+    'indexes' => array(
+      'put_map_id' => array('put_map_id')
+    ),
+    'primary key' => array('put_id')
+  );
+  $schema['importexportapi_db_put_map_alt'] = array(
+    'fields' => array(
+      'put_map_alt_id' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'auto_increment'),
+      'put_id' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      'entity' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => ''),
+      'field' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => ''),
+      'alt_field' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default'),
+      'value_alt' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => 0),
+      'value_key' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0)
+    ),
+    'indexes' => array(
+      'put_id' => array('put_id')
+    ),
+    'primary key' => array('put_map_alt_id')
+  );
+  return $schema;
 }
 
 function importexportapi_update_1() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query('CREATE TABLE {importexportapi_db_put_map_alt} (
-        put_map_alt_id int(10) NOT NULL auto_increment,
-        put_id int(10) NOT NULL default \'0\',
-        entity varchar(255) NOT NULL default \'\',
-        field varchar(255) NOT NULL default \'\',
-        alt_field varchar(255) NOT NULL default \'\',
-        value_alt varchar(255) NOT NULL default \'\',
-        value_key int(10) NOT NULL default \'0\',
-        PRIMARY KEY (put_map_alt_id),
-        KEY (put_id)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */
-      ');
-      break;
-
-    case 'pgsql':
-      db_query('CREATE TABLE {importexportapi_db_put_map_alt} (
-        put_map_alt_id SERIAL,
-        put_id integer NOT NULL default \'0\',
-        entity varchar(255) NOT NULL default \'\',
-        field varchar(255) NOT NULL default \'\',
-        alt_field varchar(255) NOT NULL default \'\',
-        value_alt varchar(255) NOT NULL default \'\',
-        value_key integer NOT NULL default \'0\',
-        PRIMARY KEY (put_map_id)
-        )
-      ');
-      db_query('CREATE INDEX {importexportapi_db_put_map_alt}_put_id_idx
-        ON {importexportapi_db_put_map_alt} (put_id)
-      ');
-      break;
-  }
+  $ret = array();
 
-  db_query('ALTER TABLE {importexportapi_put_map} RENAME TO {importexportapi_db_put_map}');
+  db_add_field($ret, 'db_put_map_alt', 'put_map_alt_id', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'auto_increment'));
+  db_add_field($ret, 'db_put_map_alt', 'put_id', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
+  db_add_field($ret, 'db_put_map_alt', 'entity', array('type' => 'varchar', 'not null' => TRUE, 'default'));
+  db_add_field($ret, 'db_put_map_alt', 'field', array('type' => 'varchar', 'not null' => TRUE, 'default'));
+  db_add_field($ret, 'db_put_map_alt', 'alt_field', array('type' => 'varchar', 'not null' => TRUE, 'default'));
+  db_add_field($ret, 'db_put_map_alt', 'value_alt', array('type' => 'varchar', 'not null' => TRUE, 'default' => 0));
+  db_add_field($ret, 'db_put_map_alt', 'value_key', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
+  db_add_index($ret, 'db_put_map_alt', 'put_map_alt_id', array('put_map_alt_id'));
 
-  return array();
+  return $ret;
 }
Index: importexportapi.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/importexportapi.module,v
retrieving revision 1.53
diff -u -p -r1.53 importexportapi.module
--- importexportapi.module	8 Feb 2007 13:30:28 -0000	1.53
+++ importexportapi.module	17 Apr 2009 02:09:02 -0000
@@ -18,8 +18,8 @@ define('IMPORTEXPORTAPI_DEPENDENCY_TIMEO
 /**
  * Implementation of hook_help().
  */
-function importexportapi_help($section) {
-  switch ($section) {
+function importexportapi_help($path, $arg) {
+  switch ($path) {
     case 'admin/help#importexportapi':
       return t('The import / export API module allows data entities in Drupal to be imported and exported in a variety of formats.');
   }
@@ -612,7 +612,6 @@ function importexportapi_get_engines($ty
       }
     }
   }
-
   if (isset($format)) {
     return isset($engines[$type][$format]) ? $engines[$type][$format] : NULL;
   }
@@ -637,13 +636,6 @@ function importexportapi_get_engines($ty
  * @param $variables
  *   An array of variables (keys and values) to be passed to the 'get' engine.
  *   One common variable that gets passed is 'raw' (the raw data to be gotten).
- * @param $put_formats
- *   An array of destination data formats, that the data definition should be
- *   built for. If you wish to perform a 'put' operation on the returned data
- *   at a later stage, you will only be able to perform it using one of the
- *   formats that has been specified here. A single format may be entered as a
- *   string instead of an array. If set to NULL, then the data gets built for
- *   all available 'put' formats. Default is NULL.
  * @param $def
  *   The entity definitions to use. If none are provided, then the standard
  *   definitions will be gotten from importexportapi_get_def() (default is
@@ -657,7 +649,6 @@ function importexportapi_get_data($entit
   if (!isset($def)) {
     $def = importexportapi_get_def(NULL, TRUE);
   }
-
   // If no 'get' format has been specified, then use the 'source' format of the
   // first available entity (default 'source' format is 'db').
   if (!isset($get_format)) {
@@ -673,7 +664,6 @@ function importexportapi_get_data($entit
   if (!function_exists($function)) {
     return NULL;
   }
-
   // Run the 'get' operations.
   $data = array();
   $entities = array_flip($entities);
Index: definitions/importexportapi_aggregator.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/definitions/importexportapi_aggregator.inc,v
retrieving revision 1.4
diff -u -p -r1.4 importexportapi_aggregator.inc
--- definitions/importexportapi_aggregator.inc	25 Mar 2007 21:21:47 -0000	1.4
+++ definitions/importexportapi_aggregator.inc	17 Apr 2009 02:09:02 -0000
@@ -22,8 +22,7 @@ function aggregator_def() {
   $def['cid'] = array(
     '#type' => 'int',
     '#title' => t('Aggregator category ID'),
-    '#key' => TRUE,
-    '#db_uses_sequences' => TRUE
+    '#key' => TRUE
   );
   $def['category_title'] = array(
     '#title' => t('Category title'),
@@ -52,8 +51,7 @@ function aggregator_def() {
   $def['fid'] = array(
     '#type' => 'int',
     '#title' => t('Aggregator feed ID'),
-    '#key' => TRUE,
-    '#db_uses_sequences' => TRUE
+    '#key' => TRUE
   );
   $def['feed_title'] = array(
     '#title' => t('Feed title'),
@@ -130,8 +128,7 @@ function aggregator_def() {
   $def['iid'] = array(
     '#type' => 'int',
     '#title' => t('Aggregator item ID'),
-    '#key' => TRUE,
-    '#db_uses_sequences' => TRUE
+    '#key' => TRUE
   );
   $def['fid'] = array(
     '#type' => 'int',
Index: definitions/importexportapi_block.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/definitions/importexportapi_block.inc,v
retrieving revision 1.5
diff -u -p -r1.5 importexportapi_block.inc
--- definitions/importexportapi_block.inc	25 Mar 2007 21:21:47 -0000	1.5
+++ definitions/importexportapi_block.inc	17 Apr 2009 02:09:02 -0000
@@ -27,11 +27,11 @@ function block_def() {
     '#db_table' => 'boxes',
     '#key' => TRUE
   );
-   $def['body'] = array(
+  $def['body'] = array(
     '#title' => t('Body'),
     '#db_table' => 'boxes'
   );
-   $def['info'] = array(
+  $def['info'] = array(
     '#title' => t('Description'),
     '#unique' => TRUE,
     '#db_table' => 'boxes'
@@ -127,7 +127,6 @@ function _block_get_def() {
   $def['title'] = array(
     '#title' => t('Title')
   );
-  
   $def['roles'] = array(
     '#type' => 'array',
     '#title' => t('Roles'),
@@ -136,7 +135,6 @@ function _block_get_def() {
     '#csv_plural' => 'blocks-roles',
     '#xml_mapping' => 'role'
   );
-  
   $def['roles']['module'] = array(
     '#title' => t('Responsible module'),
     '#reference_entity' => 'block',
Index: definitions/importexportapi_comment.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/definitions/importexportapi_comment.inc,v
retrieving revision 1.10
diff -u -p -r1.10 importexportapi_comment.inc
--- definitions/importexportapi_comment.inc	26 Dec 2006 07:05:01 -0000	1.10
+++ definitions/importexportapi_comment.inc	17 Apr 2009 02:09:02 -0000
@@ -61,10 +61,6 @@ function comment_def() {
     '#type' => 'datetime',
     '#title' => t('Last modified date')
   );
-  $def['score'] = array(
-    '#type' => 'int',
-    '#title' => t('Score')
-  );
   $def['status'] = array(
     '#type' => 'int',
     '#title' => t('Published')
Index: definitions/importexportapi_menu.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/definitions/importexportapi_menu.inc,v
retrieving revision 1.3
diff -u -p -r1.3 importexportapi_menu.inc
--- definitions/importexportapi_menu.inc	19 Sep 2006 02:41:58 -0000	1.3
+++ definitions/importexportapi_menu.inc	17 Apr 2009 02:09:02 -0000
@@ -23,8 +23,7 @@ function menu_def() {
   $def['mid'] = array(
     '#type' => 'int',
     '#title' => t('Menu item ID'),
-    '#key' => TRUE,
-    '#db_uses_sequences' => TRUE
+    '#key' => TRUE
   );
   $def['pid'] = array(
     '#type' => 'int',
Index: definitions/importexportapi_node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/definitions/importexportapi_node.inc,v
retrieving revision 1.10
diff -u -p -r1.10 importexportapi_node.inc
--- definitions/importexportapi_node.inc	25 Mar 2007 21:21:47 -0000	1.10
+++ definitions/importexportapi_node.inc	17 Apr 2009 02:09:02 -0000
@@ -54,7 +54,7 @@ function node_def() {
   );
 
   $defs['node_access'] = $def;
-  
+
   $def = array(
     '#type' => 'entity',
     '#title' => t('Node type'),
@@ -62,7 +62,7 @@ function node_def() {
     '#xml_mapping' => 'node-type',
     '#csv_plural' => 'node-types'
   );
-  
+
   $def['type'] = array(
     '#title' => t('Name (machine-readable)'),
     '#key_component' => TRUE
@@ -179,8 +179,7 @@ function importexportapi_node_get_def($t
   $def['nid'] = array(
     '#type' => 'int',
     '#title' => t('Node ID'),
-    '#key' => TRUE,
-    '#db_uses_sequences' => TRUE
+    '#key' => TRUE
   );
   $def['vid'] = array(
     '#type' => 'int',
@@ -244,8 +243,7 @@ function importexportapi_node_get_def($t
   $def['revisions']['vid'] = array(
     '#type' => 'int',
     '#title' => t('Revision ID'),
-    '#key' => TRUE,
-    '#db_uses_sequences' => TRUE
+    '#key' => TRUE
   );
   $def['revisions']['uid'] = array(
     '#type' => 'int',
Index: definitions/importexportapi_taxonomy.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/definitions/importexportapi_taxonomy.inc,v
retrieving revision 1.12
diff -u -p -r1.12 importexportapi_taxonomy.inc
--- definitions/importexportapi_taxonomy.inc	25 Mar 2007 21:21:47 -0000	1.12
+++ definitions/importexportapi_taxonomy.inc	17 Apr 2009 02:09:02 -0000
@@ -22,8 +22,7 @@ function taxonomy_def() {
   $def['vid'] = array(
     '#type' => 'int',
     '#title' => t('Vocabulary ID'),
-    '#key' => TRUE,
-    '#db_uses_sequences' => TRUE
+    '#key' => TRUE
   );
   $def['vocabulary_name'] = array(
     '#title' => t('Vocabulary name'),
@@ -102,8 +101,7 @@ function taxonomy_def() {
   $def['tid'] = array(
     '#type' => 'int',
     '#title' => t('Term ID'),
-    '#key' => TRUE,
-    '#db_uses_sequences' => TRUE
+    '#key' => TRUE
   );
   $def['vid'] = array(
     '#type' => 'int',
Index: definitions/importexportapi_user.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/definitions/importexportapi_user.inc,v
retrieving revision 1.23
diff -u -p -r1.23 importexportapi_user.inc
--- definitions/importexportapi_user.inc	29 Aug 2006 17:10:19 -0000	1.23
+++ definitions/importexportapi_user.inc	17 Apr 2009 02:09:02 -0000
@@ -62,8 +62,7 @@ function user_def() {
   $def['uid'] = array(
     '#type' => 'int',
     '#title' => t('User ID'),
-    '#key' => TRUE,
-    '#db_uses_sequences' => TRUE
+    '#key' => TRUE
   );
   $def['name'] = array(
     '#title' => t('Username'),
Index: engines/importexportapi_db_put.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/engines/importexportapi_db_put.inc,v
retrieving revision 1.29
diff -u -p -r1.29 importexportapi_db_put.inc
--- engines/importexportapi_db_put.inc	7 Feb 2007 13:09:25 -0000	1.29
+++ engines/importexportapi_db_put.inc	17 Apr 2009 02:09:03 -0000
@@ -208,7 +208,7 @@ function _importexportapi_db_put_sequenc
   $field_put = $field['#put'];
 
   if ($field_put['#db_uses_sequences'] && $GLOBALS['db_type'] != 'pgsql') {
-    $new_id = db_next_id($table .'_'. $field_put['#db_field_unaliased']);
+    $new_id = db_last_insert_id($table, $field_put['#db_field_unaliased']);
   }
   else {
     switch ($GLOBALS['db_type']) {
@@ -256,7 +256,7 @@ function _importexportapi_db_put_sequenc
 
   if ($field_put['#db_uses_sequences'] && $GLOBALS['db_type'] != 'pgsql') {
     $sequence_name = $table .'_'. $field_put['#db_field_unaliased'];
-    $result = db_fetch_object(db_query("SELECT id FROM {sequences} WHERE name = '$sequence_name'"));
+    $result = db_fetch_object(db_query("SELECT id FROM {sequences} WHERE name = '%s'", $sequence_name));
     if (!empty($result)) {
       $curr_value = (int) $result->id;
 
@@ -265,7 +265,7 @@ function _importexportapi_db_put_sequenc
       }
     }
     else {
-      db_query("INSERT INTO {sequences} (name, id) VALUES ('$sequence_name', %d)", $value);
+      db_query("INSERT INTO {sequences} (name, id) VALUES ('%s', %d)", $sequence_name, $value);
     }
   }
   elseif ($GLOBALS['db_type'] == 'pgsql') {
@@ -474,8 +474,8 @@ function _importexportapi_db_put_resolve
             if (!empty($result) && isset($result->$ref_db_field) && $result->$ref_db_field !== '') {
               // We managed to resolve the alternate key to an actual 'key'
               // value - now, copy the actual 'key' value to the 'key' field.
-               importexportapi_string_typecast($ref_field['#type'], $result->$ref_db_field);
-               $data[$key_index]['#value'] = $result->$ref_db_field;
+              importexportapi_string_typecast($ref_field['#type'], $result->$ref_db_field);
+              $data[$key_index]['#value'] = $result->$ref_db_field;
 
               // Record the alternate key that we used in the
               // '#db_resolved_alt_key' attribute of the 'key' field.
@@ -575,7 +575,7 @@ function _importexportapi_db_put_generat
         $value_old = NULL;
 
         $key_provided = isset($value);
-        $key_already_exists = (bool) db_num_rows(db_query('SELECT '. $key_put['#db_field_unaliased'] .' FROM '. $into .' WHERE '. $key_put['#db_field_unaliased'] .' = '. $placeholder_map[$key_field['#type']], $value));
+        $key_already_exists = (bool) db_result(db_query('SELECT COUNT('. $key_put['#db_field_unaliased'] .') FROM '. $into .' WHERE '. $key_put['#db_field_unaliased'] .' = '. $placeholder_map[$key_field['#type']], $value));
         $update_existing = $key_put['#db_update_existing'];
         $generate_id = $key_put['#db_generate_id'];
         $force_generate_id = $key_put['#db_force_generate_id'];
Index: libraries/minixml/hacks.txt.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/libraries/minixml/hacks.txt.php,v
retrieving revision 1.2
diff -u -p -r1.2 hacks.txt.php
--- libraries/minixml/hacks.txt.php	15 Aug 2006 17:13:12 -0000	1.2
+++ libraries/minixml/hacks.txt.php	17 Apr 2009 02:09:03 -0000
@@ -30,8 +30,6 @@
 
 2.1  Added CVS ID tag (line 3).
 2.2  Added doxygen file descriptor (lines 5-8).
-2.3  Removed the padding before the first element outputted by the _toString()
-     method (line 758).
 2.4  Removed the class 'MiniXML', since it is a redundant alias for the class
      'MiniXMLDoc' (lines 870-895).
 
@@ -39,8 +37,6 @@
 
 3.1  Added CVS ID tag (line 3).
 3.2  Added doxygen file descriptor (lines 5-8).
-3.3  Removed the space that was getting put after XML start tags (line 1127).
-3.4  Removed the space that was getting put before XML end tags (line 1163).
 
 4    node.inc.php
 
@@ -53,5 +49,5 @@
 5.2  Added doxygen file descriptor (lines 5-8).
 5.3  Changed the _spaceStr() method to use indenting spaces according to the
      new constant MINIXML_INDENT_SIZE, and to start looping from 1 instead of 0
-     (lines 162-164).
+     (lines 167-169).
 */
Index: libraries/minixml/minixml.inc.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/libraries/minixml/minixml.inc.php,v
retrieving revision 1.2
diff -u -p -r1.2 minixml.inc.php
--- libraries/minixml/minixml.inc.php	15 Aug 2006 17:13:12 -0000	1.2
+++ libraries/minixml/minixml.inc.php	17 Apr 2009 02:09:03 -0000
@@ -11,31 +11,37 @@
 ****************************************************************************************************
 *****
 *****      MiniXML - PHP class library for generating and parsing XML.
-*****
-*****      Copyright (C) 2002-2005 Patrick Deegan, Psychogenic.com
+*****                                            
+*****      Copyright (C) 2002-2008 Patrick Deegan, Psychogenic.com
 *****      All rights reserved.
 *****
-*****      http://minixml.psychogenic.com
-*****
-*****   This program is free software; you can redistribute
-*****   it and/or modify it under the terms of the GNU
-*****   General Public License as published by the Free
-*****   Software Foundation; either version 2 of the
-*****   License, or (at your option) any later version.
-*****
-*****   This program is distributed in the hope that it will
-*****   be useful, but WITHOUT ANY WARRANTY; without even
-*****   the implied warranty of MERCHANTABILITY or FITNESS
-*****   FOR A PARTICULAR PURPOSE.  See the GNU General
-*****   Public License for more details.
-*****
-*****   You should have received a copy of the GNU General
-*****   Public License along with this program; if not,
-*****   write to the Free Software Foundation, Inc., 675
-*****   Mass Ave, Cambridge, MA 02139, USA.
-*****
-*****
-*****   You may contact the author, Pat Deegan, through the
+*****      http://minixml.psychogenic.com    
+*****                                                     
+*****   
+*****   
+*****   This library is released under the terms of the GNU GPL version 3, making it available only for 
+*****   free programs ("free" here being used in the sense of the GPL, see http://www.gnu.org for more details). 
+*****   Anyone wishing to use this library within a proprietary or otherwise non-GPLed program MUST contact psychogenic.com to 
+*****   acquire a distinct license for their application.  This approach encourages the use of free software 
+*****   while allowing for proprietary solutions that support further development.
+*****   
+*****   
+*****   
+*****   miniXML is free software: you can redistribute it and/or modify
+*****   it under the terms of the GNU General Public License as published by
+*****   the Free Software Foundation, either version 3 of the License, or
+*****   (at your option) any later version.
+*****
+*****   miniXML is distributed in the hope that it will be useful,
+*****   but WITHOUT ANY WARRANTY; without even the implied warranty of
+*****   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*****   GNU General Public License for more details.
+*****
+*****   You should have received a copy of the GNU General Public License
+*****   along with miniXML.  If not, see <http://www.gnu.org/licenses/>.
+*****   
+*****   
+*****   You may contact the author, Pat Deegan, through the     
 *****   contact section at http://www.psychogenic.com
 *****
 *****   Much more information on using this API can be found on the
@@ -73,15 +79,14 @@ define("MINIXML_AVOIDLOOPS", 0); /* Set 
 
 define("MINIXML_IGNOREWHITESPACES", 1); /* Set to 1 to eliminate leading and trailing whitespaces from strings */
 
+define("MINIXML_INDENT_SIZE", 2); /* The number of spaces for indenting nested elements when using $xmlDoc->toString(). */
+
 
 /* Lower/upper case attribute names.  Choose UPPER or LOWER or neither - not both... UPPER takes precedence */
 define("MINIXML_UPPERCASEATTRIBUTES", 0); /* Set to 1 to UPPERCASE all attributes, 0 otherwise */
 define("MINIXML_LOWERCASEATTRIBUTES", 0); /* Set to 1 to lowercase all attributes, 0 otherwise */
 
 
-define("MINIXML_INDENT_SIZE", 2); /* The number of spaces for indenting nested elements when using $xmlDoc->toString(). */
-
-
 /* fromFile cache.
 ** If you are using lots of $xmlDoc->fromFile('path/to/file.xml') calls, it is possible to use
 ** a caching mechanism.  This cache will read the file, store a serialized version of the resulting
@@ -90,7 +95,7 @@ define("MINIXML_INDENT_SIZE", 2); /* The
 ** If the original XML file is updated, the cache will automatically be refreshed.
 **
 ** To use caching, set MINIXML_USEFROMFILECACHING to 1 and set the
-** MINIXML_FROMFILECACHEDIR to a suitable directory in which the cache files will
+** MINIXML_FROMFILECACHEDIR to a suitable directory in which the cache files will 
 ** be stored (eg, "/tmp")
 **/
 define("MINIXML_USEFROMFILECACHING", 0);
@@ -108,7 +113,7 @@ define("MINIXML_DEBUG", 0); /* Set Debug
 
 define("MINIXML_USE_SIMPLE", 0);
 
-define("MINIXML_VERSION", "1.3.0"); /* Version information */
+define("MINIXML_VERSION", "1.3.8"); /* Version information */
 
 define("MINIXML_NOWHITESPACES", -999); /* Flag that may be passed to the toString() methods */
 
@@ -122,7 +127,7 @@ require_once(MINIXML_CLASSDIR . "/doc.in
 /***************************************************************************************************
 ****************************************************************************************************
 *****
-*****			           Global Helper functions
+*****			           Global Helper functions 
 *****
 ****************************************************************************************************
 ***************************************************************************************************/
@@ -140,9 +145,9 @@ function _MiniXMLLog ($message)
 function _MiniXMLError ($message)
 {
 	error_log("MiniXML ERROR:\n$message\n");
-
+	
 	return NULL;
-
+	
 }
 
 
@@ -152,8 +157,8 @@ function _MiniXML_NumKeyArray (&$v)
 	{
 		return NULL;
 	}
-
-
+	
+	
 	$arrayKeys = array_keys($v);
 	$numKeys = count($arrayKeys);
 	$totalNumeric = 0;
@@ -166,7 +171,7 @@ function _MiniXML_NumKeyArray (&$v)
 			return 0;
 		}
 	}
-
+	
 	if ($totalNumeric == $numKeys)
 	{
 		// All numeric - assume it is a "straight" array
@@ -176,10 +181,10 @@ function _MiniXML_NumKeyArray (&$v)
 	}
 }
 
-
-
-
-
-
+function &_MiniXMLReturnNullByRef ()
+{
+	$emptyVar = NULL;
+	return $emptyVar;
+}
 
 ?>
Index: libraries/minixml/classes/doc.inc.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/libraries/minixml/classes/doc.inc.php,v
retrieving revision 1.1
diff -u -p -r1.1 doc.inc.php
--- libraries/minixml/classes/doc.inc.php	9 Jun 2006 16:43:28 -0000	1.1
+++ libraries/minixml/classes/doc.inc.php	17 Apr 2009 02:09:03 -0000
@@ -11,31 +11,38 @@
 ****************************************************************************************************
 *****
 *****      MiniXML - PHP class library for generating and parsing XML.
-*****
-*****      Copyright (C) 2002-2005 Patrick Deegan, Psychogenic.com
-*****      All rights reserved.
-*****
-*****      http://minixml.psychogenic.com
-*****
-*****   This program is free software; you can redistribute
-*****   it and/or modify it under the terms of the GNU
-*****   General Public License as published by the Free
-*****   Software Foundation; either version 2 of the
-*****   License, or (at your option) any later version.
-*****
-*****   This program is distributed in the hope that it will
-*****   be useful, but WITHOUT ANY WARRANTY; without even
-*****   the implied warranty of MERCHANTABILITY or FITNESS
-*****   FOR A PARTICULAR PURPOSE.  See the GNU General
-*****   Public License for more details.
-*****
-*****   You should have received a copy of the GNU General
-*****   Public License along with this program; if not,
-*****   write to the Free Software Foundation, Inc., 675
-*****   Mass Ave, Cambridge, MA 02139, USA.
-*****
-*****
-*****   You may contact the author, Pat Deegan, through the
+*****                                    
+*****      http://minixml.psychogenic.com    
+*****                                          
+*****
+*****   This module is part of the miniXML XML parser/generator package.
+*****   Copyright (C) 2002-2008 Patrick Deegan
+*****   All rights reserved
+*****   
+*****   
+*****   This library is released under the terms of the GNU GPL version 3, making it available only for 
+*****   free programs ("free" here being used in the sense of the GPL, see http://www.gnu.org for more details). 
+*****   Anyone wishing to use this library within a proprietary or otherwise non-GPLed program MUST contact psychogenic.com to 
+*****   acquire a distinct license for their application.  This approach encourages the use of free software 
+*****   while allowing for proprietary solutions that support further development.
+*****   
+*****   
+*****   
+*****   miniXML is free software: you can redistribute it and/or modify
+*****   it under the terms of the GNU General Public License as published by
+*****   the Free Software Foundation, either version 3 of the License, or
+*****   (at your option) any later version.
+*****
+*****   miniXML is distributed in the hope that it will be useful,
+*****   but WITHOUT ANY WARRANTY; without even the implied warranty of
+*****   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*****   GNU General Public License for more details.
+*****
+*****   You should have received a copy of the GNU General Public License
+*****   along with miniXML.  If not, see <http://www.gnu.org/licenses/>.
+*****   
+*****   
+*****   You may contact the author, Pat Deegan, through the     
 *****   contact section at http://www.psychogenic.com
 *****
 *****   Much more information on using this API can be found on the
@@ -51,7 +58,7 @@
 #define("MINIXML_COMPLETE_REGEX",'/<\s*([^\s>]+)([^>]+)?>(.*?)<\s*\/\\1\s*>\s*([^<]+)?(.*)|\s*<!--(.+?)-->\s*|^\s*<\s*([^\s>]+)([^>]*)\/\s*>\s*([^<>]+)?|<!\[CDATA\s*\[(.*?)\]\]\s*>|<!DOCTYPE\s*([^\[]*)\[(.*?)\]\s*>|<!ENTITY\s*([^"\'>]+)\s*(["\'])([^\14]+)\14\s*>|^([^<]+)(.*)/smi');
 */
 
-define("MINIXML_COMPLETE_REGEX",'/^\s*<\s*([^\s>]+)(\s+[^>]+)?>(.*?)<\s*\/\1\s*>\s*([^<]+)?(.*)|^\s*<!--(.+?)-->\s*(.*)|^\s*<\s*([^\s>]+)([^>]+)\/\s*>\s*(.*)|^\s*<!\[CDATA\s*\[(.*?)\]\]\s*>\s*(.*)|^\s*<!DOCTYPE\s*([^\[]*)\[(.*?)\]\s*>\s*(.*)|^\s*<!ENTITY\s*([^"\'>]+)\s*(["\'])([^\17]+)\17\s*>\s*(.*)|^([^<]+)(.*)/smi');
+define("MINIXML_COMPLETE_REGEX",'/^\s*<\s*([^\s>]+)(\s+[^>]+)?>(.*?)<\s*\/\1\s*>\s*([^<]+)?(.*)|^\s*<!--(.+?)-->\s*(.*)|^\s*<\s*([^\s>]+)([^>]*)\/\s*>\s*(.*)|^\s*<!\[CDATA\s*\[(.*?)\]\]\s*>\s*(.*)|^\s*<!DOCTYPE\s*([^\[]*)\[(.*?)\]\s*>\s*(.*)|^\s*<!ENTITY\s*([^"\'>]+)\s*(["\'])([^\17]+)\17\s*>\s*(.*)|^([^<]+)(.*)/smi');
 
 /*
 #define("MINIXML_SIMPLE_REGEX",
@@ -59,7 +66,7 @@ define("MINIXML_COMPLETE_REGEX",'/^\s*<\
 #'/\s*<\s*([^\s>]+)([^>]+)?>(.*?)<\s*\/\\1\s*>\s*([^<]+)?(.*)|\s*<!--(.+?)-->\s*|\s*<\s*([^\s>]+)([^>]*)\/\s*>\s*([^<>]+)?|^([^<]+)(.*)/smi');
 
 */
-define("MINIXML_SIMPLE_REGEX",'/^\s*<\s*([^\s>]+)(\s+[^>]+)?>(.*?)<\s*\/\1\s*>\s*([^<]+)?(.*)|^\s*<!--(.+?)-->\s*(.*)|^\s*<\s*([^\s>]+)([^>]+)\/\s*>\s*(.*)|^([^<]+)(.*)/smi');
+define("MINIXML_SIMPLE_REGEX",'/^\s*<\s*([^\s>]+)(\s+[^>]+)?>(.*?)<\s*\/\1\s*>\s*([^<]+)?(.*)|^\s*<!--(.+?)-->\s*(.*)|^\s*<\s*([^\s>]+)([^>]*)\/\s*>\s*(.*)|^([^<]+)(.*)/smi');
 
 
 require_once(MINIXML_CLASSDIR . "/element.inc.php");
@@ -77,14 +84,15 @@ require_once(MINIXML_CLASSDIR . "/elemen
 ** The MiniXMLDoc class is the programmer's handle to MiniXML functionality.
 **
 ** A MiniXMLDoc instance is created in every program that uses MiniXML.
-** With the MiniXMLDoc object, you can access the root MiniXMLElement,
+** With the MiniXMLDoc object, you can access the root MiniXMLElement, 
 ** find/fetch/create elements and read in or output XML strings.
 **/
 class MiniXMLDoc {
 	var $xxmlDoc;
 	var $xuseSimpleRegex;
 	var $xRegexIndex;
-
+	var $xRegex;
+	
 	/* MiniXMLDoc [XMLSTRING]
 	** Constructor, create and init a MiniXMLDoc object.
 	**
@@ -103,14 +111,14 @@ class MiniXMLDoc {
 		{
 			$this->fromString($string);
 		}
-
+		
 	}
-
+	
 	function init ()
 	{
 		$this->xxmlDoc = new MiniXMLElement("PSYCHOGENIC_ROOT_ELEMENT");
 	}
-
+	
 	/* getRoot
 	** Returns a reference the this document's root element
 	** (an instance of MiniXMLElement)
@@ -119,8 +127,8 @@ class MiniXMLDoc {
 	{
 		return $this->xxmlDoc;
 	}
-
-
+	
+	
 	/* setRoot NEWROOT
 	** Set the document root to the NEWROOT MiniXMLElement object.
 	**/
@@ -133,7 +141,7 @@ class MiniXMLDoc {
 			return _MiniXMLError("MiniXMLDoc::setRoot(): Trying to set non-MiniXMLElement as root");
 		}
 	}
-
+	
 	/* isElement ELEMENT
 	** Returns a true value if ELEMENT is an instance of MiniXMLElement,
 	** false otherwise.
@@ -144,11 +152,11 @@ class MiniXMLDoc {
 		{
 			return 0;
 		}
-
+		
 		return method_exists($testme, 'MiniXMLElement');
 	}
-
-
+	
+	
 	/* isNode NODE
 	** Returns a true value if NODE is an instance of MiniXMLNode,
 	** false otherwise.
@@ -159,11 +167,11 @@ class MiniXMLDoc {
 		{
 			return 0;
 		}
-
+		
 		return method_exists($testme, 'MiniXMLNode');
 	}
-
-
+	
+	
 	/* createElement NAME [VALUE]
 	** Creates a new MiniXMLElement with name NAME.
 	** This element is an orphan (has no assigned parent)
@@ -178,7 +186,7 @@ class MiniXMLDoc {
 	function &createElement ($name=NULL, $value=NULL)
 	{
 		$newElement = new MiniXMLElement($name);
-
+		
 		if (! is_null($value))
 		{
 			if (is_numeric($value))
@@ -189,17 +197,17 @@ class MiniXMLDoc {
 				$newElement->text($value);
 			}
 		}
-
+		
 		return $newElement;
 	}
-
+	
 	/* getElement NAME
 	** Searches the document for an element with name NAME.
 	**
 	** Returns a reference to the first MiniXMLElement with name NAME,
 	** if found, NULL otherwise.
 	**
-	** NOTE: The search is performed like this, returning the first
+	** NOTE: The search is performed like this, returning the first 
 	** 	 element that matches:
 	**
 	** - Check the Root Element's immediate children (in order) for a match.
@@ -209,18 +217,18 @@ class MiniXMLDoc {
 	*/
 	function &getElement ($name)
 	{
-
+	
 		$element = $this->xxmlDoc->getElement($name);
 		if (MINIXML_DEBUG > 0)
 		{
 			_MiniXMLLog("MiniXMLDoc::getElement(): Returning element $element");
 		}
-
+		
 		return $element;
-
+		
 	}
-
-
+	
+	
 	/* getElementByPath PATH
 	** Attempts to return a reference to the (first) element at PATH
 	** where PATH is the path in the structure from the root element to
@@ -253,24 +261,24 @@ class MiniXMLDoc {
 	** BUT be careful:
 	**	$accessid =& $xmlDocument->getElementByPath('partRateRequest/partList/partNum');
 	**
-	** will return the partNum element with the value "DA42".  Other partNums are
+	** will return the partNum element with the value "DA42".  Other partNums are 
 	** inaccessible by getElementByPath() - Use MiniXMLElement::getAllChildren() instead.
 	**
 	** Returns the MiniXMLElement reference if found, NULL otherwise.
 	*/
 	function &getElementByPath ($path)
 	{
-
+	
 		$element = $this->xxmlDoc->getElementByPath($path);
 		if (MINIXML_DEBUG > 0)
 		{
 			_MiniXMLLog("Returning element $element");
 		}
-
+		
 		return $element;
-
+		
 	}
-
+	
 	function fromFile ($filename)
 	{
 		$modified = stat($filename);
@@ -279,32 +287,32 @@ class MiniXMLDoc {
 			_MiniXMLError("Can't stat '$filename'");
 			return NULL;
 		}
-
+		
 		if (MINIXML_USEFROMFILECACHING > 0)
 		{
-
+			
 			$tmpName = MINIXML_FROMFILECACHEDIR . '/' . 'minixml-' . md5($filename);
-			if (MINIXML_DEBUG > 0)
+			if (MINIXML_DEBUG > 0) 
 			{
 					_MiniXMLLog("Trying to open cach file $tmpName (for '$filename')");
 			}
 			$cacheFileStat = stat($tmpName);
-
+			
 			if (is_array($cacheFileStat) && $cacheFileStat[9] > $modified[9])
 			{
-
+			
 				$fp = @fopen($tmpName,"r");
 				if ($fp)
 				{
-					if (MINIXML_DEBUG > 0)
+					if (MINIXML_DEBUG > 0) 
 					{
 						_MiniXMLLog("Reading file '$filename' from object cache instead ($tmpName)");
 					}
 					$tmpFileSize = filesize($tmpName);
 					$tmpFileContents = fread($fp, $tmpFileSize);
-
+					
 					$serializedObj = unserialize($tmpFileContents);
-
+					
 					$sRoot =& $serializedObj->getRoot();
 					if ($sRoot)
 					{
@@ -313,63 +321,63 @@ class MiniXMLDoc {
 							_MiniXMLLog("Restoring object from cache file $tmpName");
 						}
 						$this->setRoot($sRoot);
-
+						
 						/* Return immediately, such that we don't refresh the cache */
 						return $this->xxmlDoc->numChildren();
-
+						
 					} /* end if we got a root element from unserialized object */
-
+					
 				} /* end if we sucessfully opened the file */
-
-
+				
+				
 			} /* end if cache file exists and is more recent */
 		}
-
-
+		
+		
 		ob_start();
 		readfile($filename);
 		$filecontents = ob_get_contents();
 		ob_end_clean();
-
+		
 		$retVal = $this->fromString($filecontents);
-
+		
 		if (MINIXML_USEFROMFILECACHING > 0)
 		{
 			$this->saveToCache($filename);
 		}
-
+		
 		return $retVal;
-
-
+			
+		
 	}
-
+	
 	function saveToCache ($filename)
 	{
 		$tmpName = MINIXML_FROMFILECACHEDIR . '/' . 'minixml-' . md5($filename);
-
+		
 		$fp = @fopen($tmpName, "w");
-
+		
 		if (MINIXML_DEBUG > 0)
 		{
 			_MiniXMLLog("Saving object to cache as '$tmpName'");
 		}
-
+		
 		if ($fp)
 		{
-
+			
 			$serialized = serialize($this);
 			fwrite($fp, $serialized);
-
+			
 			fclose($fp);
 		} else {
 			_MiniXMLError("Could not open $tmpName for write in MiniXMLDoc::saveToCache()");
 		}
-
+		
 	}
-
+	
 	/* fromString XMLSTRING
-	**
-	** Initialise the MiniXMLDoc (and it's root MiniXMLElement) using the
+	** 
+	** Initialise the MiniXMLDoc (and it's root MiniXMLElement) using the 
 	** XML string XMLSTRING.
 	**
 	** Returns the number of immediate children the root MiniXMLElement now
@@ -378,12 +386,12 @@ class MiniXMLDoc {
 	function fromString (&$XMLString)
 	{
 		$useSimpleFlag = $this->xuseSimpleRegex;
-
-
+		
+		
 		if ($this->xuseSimpleRegex || ! preg_match('/<!DOCTYPE|<!ENTITY|<!\[CDATA/smi', $XMLString))
 		{
 			$this->xuseSimpleRegex = 1;
-
+			
 			$this->xRegexIndex = array(
 							'biname'	=> 1,
 							'biattr'	=> 2,
@@ -397,7 +405,7 @@ class MiniXMLDoc {
 							'plainrest'	=> 12
 				);
 			$regex = MINIXML_SIMPLE_REGEX;
-
+			
 		} else {
 
 			$this->xRegexIndex = array(
@@ -419,36 +427,41 @@ class MiniXMLDoc {
 				);
 			$regex = MINIXML_COMPLETE_REGEX;
 		}
-
-		$this->fromSubString($this->xxmlDoc, $XMLString, $regex);
-
+		
+		$this->xRegex = $regex;
+		
+		$XMLString = preg_replace('/.*<\?\s*xml[^>]+>/', '', $XMLString);
+		
+		
+		$this->fromSubString($this->xxmlDoc, $XMLString);
+		
 		$this->xuseSimpleRegex = $useSimpleFlag;
-
+		
 		return $this->xxmlDoc->numChildren();
-
+		
 	}
-
-
+	
+	
 	function fromArray (&$init, $params=NULL)
 	{
-
+		
 		$this->init();
-
-
+		
+		
 		if (! is_array($init) )
 		{
-
+			
 			return _MiniXMLError("MiniXMLDoc::fromArray(): Must Pass an ARRAY to initialize from");
 		}
-
+		
 		if (! is_array($params) )
 		{
 			$params = array();
 		}
-
+		
 		if ( $params["attributes"] && is_array($params["attributes"]) )
 		{
-
+			
 			$attribs = array();
 			foreach ($params["attributes"] as $attribName => $value)
 			{
@@ -456,7 +469,7 @@ class MiniXMLDoc {
 				{
 					$attribs[$attribName] = array();
 				}
-
+				
 				if (is_array($value))
 				{
 					foreach ($value as $v)
@@ -477,27 +490,27 @@ class MiniXMLDoc {
 					}
 				}
 			}
-
+			
 			// completely replace old attributes by our optimized array
 			$params["attributes"] = $attribs;
 		} else {
 			$params["attributes"] = array();
 		}
-
+		
 		foreach ($init as $keyname => $value)
 		{
 			$sub = $this->_fromArray_getExtractSub($value);
-
-
+			
+		
 			$this->$sub($keyname, $value, $this->xxmlDoc, $params);
-
+		
 		}
-
-
+		
+		
 		return $this->xxmlDoc->numChildren();
-
+		
 	}
-
+	
 	function _fromArray_getExtractSub ($v)
 	{
 		// is it a string, a numerical array or an associative array?
@@ -511,237 +524,252 @@ class MiniXMLDoc {
 			} else {
 				$sub .= "AssociativeARRAY";
 			}
-
+			
 		} else {
 			$sub .= "STRING";
 		}
-
-
+		
+	
 		return $sub;
 	}
-
-
-
-
-
+	
+	
+	
+	
+		
 	function _fromArray_extractAssociativeARRAY ($name, &$value, &$parent, &$params)
 	{
-
+		
 		$thisElement =& $parent->createChild($name);
-
+		
 		foreach ($value as $key => $val)
 		{
-
+		
 			$sub = $this->_fromArray_getExtractSub($val);
-
-
+			
+		
 			$this->$sub($key, $val, $thisElement, $params);
-
+		
 		}
-
+		
 		return;
 	}
 
 	function _fromArray_extractARRAY ($name, &$value, &$parent, &$params)
 	{
-
+		
 		foreach ($value as $val)
 		{
 			$sub = $this->_fromArray_getExtractSub($val);
-
-
+			
+		
 			$this->$sub($name, $val, $parent, $params);
-
+			
 		}
-
+		
 		return;
 	}
-
+		
 
 	function _fromArray_extractSTRING ($name, $value="", &$parent, &$params)
 	{
-
+		
 		$pname = $parent->name();
-
-		if (
+		
+		if ( 
 			( array_key_exists($pname, $params['attributes']) && is_array($params['attributes'][$pname])
 			  && array_key_exists($name, $params['attributes'][$pname]) && $params['attributes'][$pname][$name])
-		     || (
-		     	  array_key_exists('-all', $params['attributes']) && is_array($params['attributes']['-all'])
+		     || ( 
+		     	  array_key_exists('-all', $params['attributes']) && is_array($params['attributes']['-all']) 
 			  && array_key_exists($name, $params['attributes']['-all']) && $params['attributes']['-all'][$name])
 		   )
 		{
 			$parent->attribute($name, $value);
 		} elseif ($name == '-content') {
-
+		
 			$parent->text($value);
 		} else {
 			$parent->createChild($name, $value);
 		}
-
+		
 		return;
 	}
 
-
-
+	
+	
 	function time ($msg)
 	{
 		error_log("\nMiniXML msg '$msg', time: ". time() . "\n");
 	}
 	// fromSubString PARENTMINIXMLELEMENT XMLSUBSTRING
 	// private method, called recursively to parse the XMLString in little sub-chunks.
-	function fromSubString (&$parentElement, &$XMLString, &$regex)
+	function fromSubString (&$parentElement, &$XMLString)
 	{
 		//$this->time('fromSubStr');
-
+		
 		if (is_null($parentElement) || empty($XMLString) || preg_match('/^\s*$/', $XMLString))
 		{
 			return;
 		}
-		if (MINIXML_DEBUG > 0)
+		if (MINIXML_DEBUG > 0) 
 		{
 			_MiniXMLLog("Called fromSubString() with parent '" . $parentElement->name() . "'\n");
 		}
-
-		$matches = array();
-		if (preg_match_all(  $regex, $XMLString, $matches))
+		
+		if ($this->xuseSimpleRegex)
 		{
-			// $this->time('a match');
-
-			$mcp = $matches;
-
+			$tailEndIndexes = array(5, 7, 10, 12);
+		} else {
+			$tailEndIndexes = array(5, 7, 10, 12, 15, 19, 21);
+		}
+		
+		$numTailEndIndexes = count($tailEndIndexes);
+		
+		$mcp = array();		
+		if (preg_match_all($this->xRegex, $XMLString, $mcp))
+		{
+			
 			$numMatches = count($mcp[0]);
-
+			unset($mcp[0]); // no longer need the 0th array
 			for($i=0; $i < $numMatches; $i++)
 			{
-				if (MINIXML_DEBUG > 1)
-				{
-					_MiniXMLLog ("Got $numMatches CHECKING: ". $mcp[0][$i] . "\n");
-				}
 
 				$uname = $mcp[$this->xRegexIndex['uname']][$i];
 				$comment = $mcp[$this->xRegexIndex['comment']][$i];
+				
 				if ($this->xuseSimpleRegex)
 				{
 					$cdata = NULL;
 					$doctypecont = NULL;
 					$entityname = NULL;
-
-					$tailEndIndexes = array(5, 7, 10, 12);
+					
 				} else {
-
+				
 					$cdata = $mcp[$this->xRegexIndex['cdata']][$i];
 					$doctypecont = $mcp[$this->xRegexIndex['doctypecont']][$i];
 					$entityname = $mcp[$this->xRegexIndex['entityname']][$i];
-
-					$tailEndIndexes = array(5, 7, 10, 12, 15, 19, 21);
+					
 				}
-
+				
+				
 				$plaintext = $mcp[$this->xRegexIndex['plaintxt']][$i];
-
+				
 				// check all the 'tailend' (i.e. rest of string) matches for more content
 				$moreContent = '';
 				$idx = 0;
-				while (empty($moreContent) && ($idx < count($tailEndIndexes)))
+				while (empty($moreContent) && ($idx < $numTailEndIndexes))
 				{
 					if (! empty($mcp[$tailEndIndexes[$idx]][$i]))
 					{
 						$moreContent = $mcp[$tailEndIndexes[$idx]][$i];
 					}
-
+					
 					$idx++;
 				}
-
-
-
+				
+				
+				
 				if ($uname)
 				{
 					// _MiniXMLLog ("Got UNARY $uname");
 					$newElement =& $parentElement->createChild($uname);
 					$this->_extractAttributesFromString($newElement, $mcp[$this->xRegexIndex['uattr']][$i]);
-
+					unset($newElement);
+	
 				} elseif ($comment) {
 					//_MiniXMLLog ("Got comment $comment");
 					$parentElement->comment($comment);
-
+					
 				} elseif ($cdata) {
 					//_MiniXMLLog ("Got cdata $cdata");
-					$newElement = new MiniXMLElementCData($cdata);
-					$parentElement->appendChild($newElement);
+					$parentElement->appendChild(new MiniXMLElementCData($cdata));
+					
 				} elseif ($doctypecont) {
 					//_MiniXMLLog ("Got doctype $doctypedef '" . $mcp[11][$i] . "'");
 					$newElement = new MiniXMLElementDocType($mcp[$this->xRegexIndex['doctypedef']][$i]);
 					$appendedChild =& $parentElement->appendChild($newElement);
-					$this->fromSubString($appendedChild, $doctypecont, $regex);
-
+					
+					unset($newElement);
+					
+					$this->fromSubString($appendedChild, $doctypecont);
+					
+					unset($appendedChild);
+					
 				} elseif ($entityname ) {
 					//_MiniXMLLog ("Got entity $entityname");
 					$newElement = new MiniXMLElementEntity ($entityname, $mcp[$this->xRegexIndex['entitydef']][$i]);
 					$parentElement->appendChild($newElement);
-
+					
+					unset($newElement);
+					
 				} elseif ($plaintext) {
-
+				
 					if (! preg_match('/^\s+$/', $plaintext))
 					{
 						$parentElement->createNode($plaintext);
 					}
-
+					
 				} elseif($mcp[$this->xRegexIndex['biname']]) {
-
+				
 					// _MiniXMLLog("Got BIN NAME: " . $mcp[$this->xRegexIndex['biname']][$i]);
-
+					
 					$nencl = $mcp[$this->xRegexIndex['biencl']][$i];
 					$finaltxt = $mcp[$this->xRegexIndex['biendtxt']][$i];
-
+					
 					$newElement =& $parentElement->createChild($mcp[$this->xRegexIndex['biname']][$i]);
+					
 					$this->_extractAttributesFromString($newElement, $mcp[$this->xRegexIndex['biattr']][$i]);
-
-
-
+					
+					
+					
 					$plaintxtMatches = array();
 					if (preg_match("/^\s*([^\s<][^<]*)/", $nencl, $plaintxtMatches))
 					{
 						$txt = $plaintxtMatches[1];
 						$newElement->createNode($txt);
-
+						
 						$nencl = preg_replace("/^\s*([^<]+)/", "", $nencl);
 					}
-
+					
 
 					if ($nencl && !preg_match('/^\s*$/', $nencl))
 					{
-						$this->fromSubString($newElement, $nencl, $regex);
+						$this->fromSubString($newElement, $nencl);
 					}
-
+					
+					
+					unset($newElement);
+					
 					if ($finaltxt)
 					{
 						$parentElement->createNode($finaltxt);
 					}
-
-
+					
+					
 				} /* end switch over type of match */
-
+				
 				if (! empty($moreContent))
 				{
-					$this->fromSubString($parentElement, $moreContent, $regex);
+					$this->fromSubString($parentElement, $moreContent);
 				}
-
-
+			
+				
 			} /* end loop over all matches */
-
-
+			
+			unset($parentElement);
+			
 		} /* end if there was a match */
-
+		
 	} /* end method fromSubString */
-
-
+		
+	
 	/* toString [DEPTH]
 	** Converts this MiniXMLDoc object to a string and returns it.
 	**
 	** The optional DEPTH may be passed to set the space offset for the
 	** first element.
 	**
-	** If the optional DEPTH is set to MINIXML_NOWHITESPACES.
+	** If the optional DEPTH is set to MINIXML_NOWHITESPACES.  
 	** When it is, no \n or whitespaces will be inserted in the xml string
 	** (ie it will all be on a single line with no spaces between the tags.
 	**
@@ -750,59 +778,59 @@ class MiniXMLDoc {
 	function toString ($depth=0)
 	{
 		$retString = $this->xxmlDoc->toString($depth);
-
+		
 		if ($depth == MINIXML_NOWHITESPACES)
 		{
 			$xmlhead = "<?xml version=\"1.0\"\\1?>";
 		} else {
-			$xmlhead = "<?xml version=\"1.0\"\\1?>\n";
+			$xmlhead = "<?xml version=\"1.0\"\\1?>\n ";
 		}
 		$search = array("/<PSYCHOGENIC_ROOT_ELEMENT([^>]*)>\s*/smi",
 				"/<\/PSYCHOGENIC_ROOT_ELEMENT>/smi");
 		$replace = array($xmlhead,
 				"");
 		$retString = preg_replace($search, $replace, $retString);
-
-
+		
+		
 		if (MINIXML_DEBUG > 0)
 		{
 			_MiniXMLLog("MiniXML::toString() Returning XML:\n$retString\n\n");
 		}
-
-
+		
+		
 		return $retString;
 	}
-
-
+	
+	
 	/* toArray
 	**
-	** Transforms the XML structure currently represented by the MiniXML Document object
+	** Transforms the XML structure currently represented by the MiniXML Document object 
 	** into an array.
-	**
-	** More docs to come - for the moment, use var_dump($miniXMLDoc->toArray()) to see
+	** 
+	** More docs to come - for the moment, use var_dump($miniXMLDoc->toArray()) to see 
 	** what's going on :)
 	*/
-
+	
 	function & toArray ()
 	{
-
+		
 		$retVal = $this->xxmlDoc->toStructure();
-
+	
 		if (is_array($retVal))
 		{
 			return $retVal;
 		}
-
+		
 		$retArray = array(
 					'-content'	=> $retVal,
 				);
-
+		
 		return $retArray;
 	}
 
-
-
-
+	
+	
+	
 	/* getValue()
 	** Utility function, call the root MiniXMLElement's getValue()
 	*/
@@ -810,9 +838,9 @@ class MiniXMLDoc {
 	{
 		return $this->xxmlDoc->getValue();
 	}
-
-
-
+	
+	
+	
 	/* dump
 	** Debugging aid, dump returns a nicely formatted dump of the current structure of the
 	** MiniXMLDoc object.
@@ -821,38 +849,39 @@ class MiniXMLDoc {
 	{
 		return serialize($this);
 	}
-
-
-
+	
+	
+	
 	// _extractAttributesFromString
 	// private method for extracting and setting the attributs from a
 	// ' a="b" c = "d"' string
 	function _extractAttributesFromString (&$element, &$attrString)
 	{
-
+	
 		if (! $attrString)
 		{
 			return NULL;
 		}
-
+		
 		$count = 0;
 		$attribs = array();
-		// Set the attribs
+		// Set the attribs 
 		preg_match_all('/([^\s]+)\s*=\s*([\'"])([^\2]*?)\2/sm', $attrString, $attribs);
-
-
-		for ($i = 0; $i < count($attribs[0]); $i++)
+		
+		$numAttribs = count($attribs[0]);
+		
+		for ($i = 0; $i < $numAttribs; $i++)
 		{
 			$attrname = $attribs[1][$i];
 			$attrval = $attribs[3][$i];
-
+			
 			if ($attrname)
 			{
 				$element->attribute($attrname, $attrval, '');
 				$count++;
 			}
 		}
-
+		
 		return $count;
 	}
 
@@ -861,11 +890,9 @@ class MiniXMLDoc {
 	{
 		$this->xxmlDoc = null;
 	}
-
-
+		
+	
 }
 
 
-
 ?>
-
Index: libraries/minixml/classes/element.inc.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/libraries/minixml/classes/element.inc.php,v
retrieving revision 1.1
diff -u -p -r1.1 element.inc.php
--- libraries/minixml/classes/element.inc.php	9 Jun 2006 16:43:28 -0000	1.1
+++ libraries/minixml/classes/element.inc.php	17 Apr 2009 02:09:03 -0000
@@ -11,31 +11,36 @@
 ****************************************************************************************************
 *****
 *****      MiniXML - PHP class library for generating and parsing XML.
-*****
+*****                                            
 *****      Copyright (C) 2002-2005 Patrick Deegan, Psychogenic.com
 *****      All rights reserved.
 *****
-*****      http://minixml.psychogenic.com
-*****
-*****   This program is free software; you can redistribute
-*****   it and/or modify it under the terms of the GNU
-*****   General Public License as published by the Free
-*****   Software Foundation; either version 2 of the
-*****   License, or (at your option) any later version.
-*****
-*****   This program is distributed in the hope that it will
-*****   be useful, but WITHOUT ANY WARRANTY; without even
-*****   the implied warranty of MERCHANTABILITY or FITNESS
-*****   FOR A PARTICULAR PURPOSE.  See the GNU General
-*****   Public License for more details.
+*****      http://minixml.psychogenic.com    
+*****                                 
+*****   
+*****   This library is released under the terms of the GNU GPL version 3, making it available only for 
+*****   free programs ("free" here being used in the sense of the GPL, see http://www.gnu.org for more details). 
+*****   Anyone wishing to use this library within a proprietary or otherwise non-GPLed program MUST contact psychogenic.com to 
+*****   acquire a distinct license for their application.  This approach encourages the use of free software 
+*****   while allowing for proprietary solutions that support further development.
+*****   
+*****   
+*****   
+*****   miniXML is free software: you can redistribute it and/or modify
+*****   it under the terms of the GNU General Public License as published by
+*****   the Free Software Foundation, either version 3 of the License, or
+*****   (at your option) any later version.
 *****
-*****   You should have received a copy of the GNU General
-*****   Public License along with this program; if not,
-*****   write to the Free Software Foundation, Inc., 675
-*****   Mass Ave, Cambridge, MA 02139, USA.
+*****   miniXML is distributed in the hope that it will be useful,
+*****   but WITHOUT ANY WARRANTY; without even the implied warranty of
+*****   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*****   GNU General Public License for more details.
 *****
-*****
-*****   You may contact the author, Pat Deegan, through the
+*****   You should have received a copy of the GNU General Public License
+*****   along with miniXML.  If not, see <http://www.gnu.org/licenses/>.
+*****   
+*****   
+*****   You may contact the author, Pat Deegan, through the     
 *****   contact section at http://www.psychogenic.com
 *****
 *****   Much more information on using this API can be found on the
@@ -65,7 +70,7 @@ require_once(MINIXML_CLASSDIR . "/node.i
 ** much of the functionality and manipulation involves interaction with
 ** MiniXMLElement objects.
 **
-** A MiniXMLElement
+** A MiniXMLElement 
 ** has:
 ** - a name
 ** - a list of 0 or more attributes (which have a name and a value)
@@ -74,23 +79,25 @@ require_once(MINIXML_CLASSDIR . "/node.i
 **/
 
 class MiniXMLElement extends MiniXMLTreeComponent {
-
-
+	
+	
 	var $xname;
 	var $xattributes;
 	var $xchildren;
 	var $xnumChildren;
 	var $xnumElementChildren;
+	var $iselement;
 
 	var $xavoidLoops = MINIXML_AVOIDLOOPS;
-
-
+	
+	
 	/* MiniXMLElement NAME
 	** Creates and inits a new MiniXMLElement
 	*/
 	function MiniXMLElement ($name=NULL)
 	{
 		$this->MiniXMLTreeComponent();
+		$this->iselement = 1;
 		$this->xname = NULL;
 		$this->xattributes = array();
 		$this->xchildren = array();
@@ -103,14 +110,14 @@ class MiniXMLElement extends MiniXMLTree
 			return _MiniXMLError("MiniXMLElement Constructor: must pass a name to constructor");
 		}
 	} /* end method MiniXMLElement */
-
-
+	
+	
 	/**************** Get/set methods for MiniXMLElement data *****************/
-
-
+	
+	
 	/* name [NEWNAME]
 	**
-	** If a NEWNAME string is passed, the MiniXMLElement's name is set
+	** If a NEWNAME string is passed, the MiniXMLElement's name is set 
 	** to NEWNAME.
 	**
 	** Returns the element's name.
@@ -123,25 +130,25 @@ class MiniXMLElement extends MiniXMLTree
 			{
 				return _MiniXMLError("MiniXMLElement::name() Must pass a STRING to method to set name");
 			}
-
+			
 			$this->xname = $setTo;
 		}
-
+		
 		return $this->xname;
-
+		
 	} /* end method name */
-
-
-
+	
+	
+	
 	/* attribute NAME [SETTO [SETTOALT]]
 	**
-	** The attribute() method is used to get and set the
+	** The attribute() method is used to get and set the 
 	** MiniXMLElement's attributes (ie the name/value pairs contained
 	** within the tag, <tagname attrib1="value1" attrib2="value2">)
 	**
 	** If SETTO is passed, the attribute's value is set to SETTO.
 	**
-	** If the optional SETTOALT is passed and SETTO is false, the
+	** If the optional SETTOALT is passed and SETTO is false, the 
 	** attribute's value is set to SETTOALT.  This is usefull in cases
 	** when you wish to set the attribute to a default value if no SETTO is
 	** present, eg $myelement->attribute('href', $theHref, 'http://psychogenic.com')
@@ -165,51 +172,51 @@ class MiniXMLElement extends MiniXMLTree
 		{
 			$name = strtolower($name);
 		}
-
+		
 		if (! is_null($value))
 		{
-
+			
 			$this->xattributes[$name] = $value;
 		}
-
+		
 		if (! is_null($this->xattributes[$name]))
 		{
 			return $this->xattributes[$name];
 		} else {
 			return NULL;
 		}
-
+		
 	} /* end method attribute */
-
+	
 
 	/* text [SETTO [SETTOALT]]
 	**
 	** The text() method is used to get or append text data to this
 	** element (it is appended to the child list as a new MiniXMLNode object).
 	**
-	** If SETTO is passed, a new node is created, filled with SETTO
+	** If SETTO is passed, a new node is created, filled with SETTO 
 	** and appended to the list of this element's children.
 	**
-	** If the optional SETTOALT is passed and SETTO is false, the
+	** If the optional SETTOALT is passed and SETTO is false, the 
 	** new node's value is set to SETTOALT.  See the attribute() method
 	** for an example use.
-	**
+	** 
 	** Returns a string composed of all child MiniXMLNodes' contents.
 	**
-	** Note: all the children MiniXMLNodes' contents - including numeric
+	** Note: all the children MiniXMLNodes' contents - including numeric 
 	** nodes are included in the return string.
 	*/
 	function text ($setToPrimary = NULL, $setToAlternate=NULL)
 	{
 		$setTo = ($setToPrimary ? $setToPrimary : $setToAlternate);
-
+		
 		if (! is_null($setTo))
 		{
 			$this->createNode($setTo);
 		}
-
+		
 		$retString = '';
-
+		
 		/* Extract text from all child nodes */
 		for($i=0; $i< $this->xnumChildren; $i++)
 		{
@@ -219,32 +226,32 @@ class MiniXMLElement extends MiniXMLTree
 				if (! is_null($nodeTxt))
 				{
 					$retString .= "$nodeTxt ";
-
+					
 				} /* end if text returned */
-
+				
 			} /* end if this is a MiniXMLNode */
-
+			
 		} /* end loop over all children */
-
+		
 		return $retString;
-
+		
 	}  /* end method text */
-
-
-
+	
+	
+	
 	/* numeric [SETTO [SETTOALT]]
 	**
 	** The numeric() method is used to get or append numeric data to
 	** this element (it is appended to the child list as a MiniXMLNode object).
 	**
-	** If SETTO is passed, a new node is created, filled with SETTO
+	** If SETTO is passed, a new node is created, filled with SETTO 
 	** and appended to the list of this element's children.
 	**
-	** If the optional SETTOALT is passed and SETTO is false, the
+	** If the optional SETTOALT is passed and SETTO is false, the 
 	** new node's value is set to SETTOALT.  See the attribute() method
 	** for an example use.
-	**
-	** Returns a space seperated string composed all child MiniXMLNodes'
+	** 
+	** Returns a space seperated string composed all child MiniXMLNodes' 
 	** numeric contents.
 	**
 	** Note: ONLY numerical contents are included from the list of child MiniXMLNodes.
@@ -253,15 +260,15 @@ class MiniXMLElement extends MiniXMLTree
 	function numeric ($setToPrimary = NULL, $setToAlternate=NULL)
 	{
 		$setTo = (is_null($setToPrimary) ? $setToAlternate : $setToPrimary);
-
+		
 		if (! is_null($setTo))
 		{
 			$this->createNode($setTo);
 		}
-
+		
 	} /* end method numeric */
-
-
+	
+	
 	/* comment CONTENTS
 	**
 	** The comment() method allows you to add a new MiniXMLElementComment to this
@@ -275,81 +282,75 @@ class MiniXMLElement extends MiniXMLTree
 	*/
 	function & comment ($contents)
 	{
-		$newEl = new MiniXMLElementComment();
-
-		$appendedComment =& $this->appendChild($newEl);
+		$appendedComment =& $this->appendChild(new MiniXMLElementComment());
 		$appendedComment->text($contents);
-
+		
+		
 		return $appendedComment;
-
+		
 	} /* end method comment */
-
-
-
-
-
-
-
+		
+	
+	
+	
+		
+		
+	
 	/*
 	** docType DEFINITION
 	**
-	** Append a new <!DOCTYPE DEFINITION [ ...]> element as a child of this
+	** Append a new <!DOCTYPE DEFINITION [ ...]> element as a child of this 
 	** element.
-	**
+	** 
 	** Returns the appended DOCTYPE element. You will normally use the returned
 	** element to add ENTITY elements, like
-
+	
 	** $newDocType =& $xmlRoot->docType('spec SYSTEM "spec.dtd"');
 	** $newDocType->entity('doc.audience', 'public review and discussion');
 	*/
-
+	
 	function & docType ($definition)
 	{
-
-		$newElement = new MiniXMLElementDocType($definition);
-		$appendedElement =& $this->appendChild($newElement);
-
+		$appendedElement =& $this->appendChild(new MiniXMLElementDocType($definition));
+		
 		return $appendedElement;
 	}
 	/*
 	** entity NAME VALUE
 	**
-	** Append a new <!ENTITY NAME "VALUE"> element as a child of this
+	** Append a new <!ENTITY NAME "VALUE"> element as a child of this 
 	** element.
-
+	
 	** Returns the appended ENTITY element.
 	*/
 	function & entity ($name,$value)
 	{
-
-		$newElement = new MiniXMLElementEntity($name, $value);
-		$appendedEl =& $this->appendChild($newElement);
-
+		$appendedEl =& $this->appendChild(new MiniXMLElementEntity($name, $value));
+		
 		return $appendedEl;
 	}
-
-
-	/*
+	
+	
+	/* 
 	** cdata CONTENTS
-	**
+	** 
 	** Append a new <![CDATA[ CONTENTS ]]> element as a child of this element.
 	** Returns the appended CDATA element.
-	**
+	** 
 	*/
-
+	
 	function & cdata ($contents)
 	{
-		$newElement = new MiniXMLElementCData($contents);
-		$appendedChild =& $this->appendChild($newElement);
-
+		$appendedChild =& $this->appendChild(new MiniXMLElementCData($contents));
+		
 		return $appendedChild;
 	}
-
-
+		
+		
 	/* getValue
 	**
 	** Returns a string containing the value of all the element's
-	** child MiniXMLNodes (and all the MiniXMLNodes contained within
+	** child MiniXMLNodes (and all the MiniXMLNodes contained within 
 	** it's child MiniXMLElements, recursively).
 	**
 	** Note: the seperator parameter remains officially undocumented
@@ -372,18 +373,18 @@ class MiniXMLElement extends MiniXMLTree
 			$retStr = implode($seperator, $valArray);
 		}
 		return $retStr;
-
+		
 	} /* end method getValue */
-
-
-
+	
+	
+	
 	/* getElement NAME
 	** Searches the element and it's children for an element with name NAME.
 	**
 	** Returns a reference to the first MiniXMLElement with name NAME,
 	** if found, NULL otherwise.
 	**
-	** NOTE: The search is performed like this, returning the first
+	** NOTE: The search is performed like this, returning the first 
 	** 	 element that matches:
 	**
 	** - Check this element for a match
@@ -394,7 +395,7 @@ class MiniXMLElement extends MiniXMLTree
 	*/
 	function &getElement ($name)
 	{
-
+		
 		if (MINIXML_DEBUG > 0)
 		{
 			$elname = $this->name();
@@ -404,8 +405,8 @@ class MiniXMLElement extends MiniXMLTree
 		{
 			return _MiniXMLError("MiniXMLElement::getElement() Must Pass Element name.");
 		}
-
-
+		
+		
 		/** Must only check children as checking $this results in an inability to
 		*** fetch nested objects with the same name
 		*** <tag>
@@ -423,22 +424,22 @@ class MiniXMLElement extends MiniXMLTree
 				return $this;
 			}
 		} else {
-
+		
 			if (strcasecmp($this->xname,$name) == 0)
 			{
 				return $this;
 			}
 		}
-
+		
 		***** end commented out section ****
 		*/
-
+		
 		if (! $this->xnumChildren )
 		{
 			/* Not match here and and no kids - not found... */
 			return NULL;
 		}
-
+		
 		/* Try each child (immediate children take priority) */
 		for ($i = 0; $i < $this->xnumChildren; $i++)
 		{
@@ -460,9 +461,9 @@ class MiniXMLElement extends MiniXMLTree
 					}
 				} /* end if case sensitive */
 			} /* end if child has a name */
-
+			
 		} /* end loop over all my children */
-
+		
 		/* Use beautiful recursion, daniel san */
 		for ($i = 0; $i < $this->xnumChildren; $i++)
 		{
@@ -476,14 +477,14 @@ class MiniXMLElement extends MiniXMLTree
 				return $theelement;
 			}
 		}
-
+		
 		/* Not found */
-		return NULL;
-
-
+		return _MiniXMLReturnNullByRef();
+		
+		
 	}  /* end method getElement */
-
-
+	
+	
 	/* getElementByPath PATH
 	** Attempts to return a reference to the (first) element at PATH
 	** where PATH is the path in the structure (relative to this element) to
@@ -518,7 +519,7 @@ class MiniXMLElement extends MiniXMLTree
 	** BUT be careful:
 	**	$accessid =& $partRate->getElementByPath('partList/partNum');
 	**
-	** will return the partNum element with the value "DA42".  Other partNums are
+	** will return the partNum element with the value "DA42".  Other partNums are 
 	** inaccessible by getElementByPath() - Use MiniXMLElement::getAllChildren() instead.
 	**
 	** Returns the MiniXMLElement reference if found, NULL otherwise.
@@ -526,7 +527,7 @@ class MiniXMLElement extends MiniXMLTree
 	function &getElementByPath($path)
 	{
 		$names = split ("/", $path);
-
+		
 		$element = $this;
 		foreach ($names as $elementName)
 		{
@@ -536,18 +537,18 @@ class MiniXMLElement extends MiniXMLTree
 				$element =& $element->getElement($elementName);
 			}
 		}
-
+		
 		return $element;
-
+		
 	} /* end method getElementByPath */
-
-
-
+	
+	
+	
 	/* numChildren [NAMED]
-	**
+	** 
 	** Returns the number of immediate children for this element
 	**
-	** If the optional NAMED parameter is passed, returns only the
+	** If the optional NAMED parameter is passed, returns only the 
 	** number of immediate children named NAMED.
 	*/
 	function numChildren ($named=NULL)
@@ -556,16 +557,16 @@ class MiniXMLElement extends MiniXMLTree
 		{
 			return $this->xnumElementChildren;
 		}
-
+		
 		/* We require only children named '$named' */
 		$allkids =& $this->getAllChildren($named);
-
+		
 		return count($allkids);
-
-
+		
+		
 	}
 
-
+	
 	/* getAllChildren [NAME]
 	**
 	** Returns a reference to an array of all this element's MiniXMLElement children
@@ -577,7 +578,7 @@ class MiniXMLElement extends MiniXMLTree
 	{
 		$retArray = array();
 		$count = 0;
-
+		
 		if (is_null($name))
 		{
 			/* Return all element children */
@@ -607,71 +608,71 @@ class MiniXMLElement extends MiniXMLTree
 							$retArray[$count++] =& $this->xchildren[$i];
 						}
 					} /* end if case sensitive */
-
+					
 				} /* end if child is a MiniXMLElement object */
-
+				
 			} /* end loop over all children */
-
+			
 		} /* end if specific name was requested */
-
+			
 		return $retArray;
-
+		
 	} /* end method getAllChildren */
-
-
-
+	
+		
+		
 	function &insertChild (&$child, $idx=0)
 	{
-
-
-
+		
+		
+		
 		if (! $this->_validateChild($child))
 		{
 			return;
 		}
-
-		/* Set the parent for the child element to this element if
+		
+		/* Set the parent for the child element to this element if 
 		** avoidLoops or MINIXML_AUTOSETPARENT is set
 		*/
 		if ($this->xavoidLoops || (MINIXML_AUTOSETPARENT > 0) )
 		{
 			if ($this->xparent == $child)
 			{
-
+				
 				$cname = $child->name();
-				return _MiniXMLError("MiniXMLElement::insertChild() Tryng to append parent $cname as child of "
+				return _MiniXMLError("MiniXMLElement::insertChild() Tryng to append parent $cname as child of " 
 							. $this->xname );
 			}
 			$child->parent($this);
 		}
-
-
+		
+		
 		$nextIdx = $this->xnumChildren;
 		$lastIdx = $nextIdx - 1;
 		if ($idx > $lastIdx)
 		{
-
+		
 			if ($idx > $nextIdx)
 			{
 				$idx = $lastIdx + 1;
 			}
-			$this->xchildren[$idx] = $child;
+			$this->xchildren[$idx] =& $child;
 			$this->xnumChildren++;
 			if ($this->isElement($child))
 			{
 				$this->xnumElementChildren++;
 			}
-
+			
 		} elseif ($idx >= 0)
 		{
-
+			
 			$removed = array_splice($this->xchildren, $idx);
 			array_push($this->xchildren, $child);
 			$numRemoved = count($removed);
-
+			
 			for($i=0; $i<$numRemoved; $i++)
 			{
-
+			
 				array_push($this->xchildren, $removed[$i]);
 			}
 			$this->xnumChildren++;
@@ -679,23 +680,23 @@ class MiniXMLElement extends MiniXMLTree
 			{
 				$this->xnumElementChildren++;
 			}
-
-
+			
+			
 		} else {
 			$revIdx = (-1 * $idx) % $this->xnumChildren;
 			$newIdx = $this->xnumChildren - $revIdx;
-
+			
 			if ($newIdx < 0)
 			{
 				return _MiniXMLError("Element::insertChild() Ended up with a negative index? ($newIdx)");
 			}
-
+			
 			return $this->insertChild($child, $newIdx);
 		}
-
+			
 		return $child;
 	}
-
+		
 
 	/* appendChild CHILDELEMENT
 	**
@@ -714,96 +715,96 @@ class MiniXMLElement extends MiniXMLTree
 	*/
 	function &appendChild (&$child)
 	{
-
+		
 		if (! $this->_validateChild($child))
 		{
 			_MiniXMLLog("MiniXMLElement::appendChild() Could not validate child, aborting append");
-			return NULL;
+			return _MiniXMLReturnNullByRef();
 		}
-
-		/* Set the parent for the child element to this element if
+		
+		/* Set the parent for the child element to this element if 
 		** avoidLoops or MINIXML_AUTOSETPARENT is set
 		*/
 		if ($this->xavoidLoops || (MINIXML_AUTOSETPARENT > 0) )
 		{
 			if ($this->xparent == $child)
 			{
-
+				
 				$cname = $child->name();
-				return _MiniXMLError("MiniXMLElement::appendChild() Tryng to append parent $cname as child of "
+				return _MiniXMLError("MiniXMLElement::appendChild() Tryng to append parent $cname as child of " 
 							. $this->xname );
 			}
 			$child->parent($this);
 		}
-
-
+		
+		
 		$this->xnumElementChildren++; /* Note that we're addind a MiniXMLElement child */
-
+		
 		/* Add the child to the list */
 		$idx = $this->xnumChildren++;
 		$this->xchildren[$idx] =& $child;
-
+		
 		return $this->xchildren[$idx];
-
+		
 	} /* end method appendChild */
-
-
+	
+	
 	/* prependChild CHILDELEMENT
 	**
 	** prependChild is used to prepend an existing MiniXMLElement object to
-	** this element's list.  The child will be positioned at the begining of
+	** this element's list.  The child will be positioned at the begining of 
 	** the elements child list, thus it will be output first in the resulting XML.
 	**
 	** Returns a reference to the prepended child element.
 	*/
 	function &prependChild ($child)
 	{
-
-
+		
+		
 		if (! $this->_validateChild($child))
 		{
 			_MiniXMLLog("MiniXMLElement::prependChild - Could not validate child, aborting.");
-			return NULL;
+			return _MiniXMLReturnNullByRef();
 		}
-
-		/* Set the parent for the child element to this element if
+		
+		/* Set the parent for the child element to this element if 
 		** avoidLoops or MINIXML_AUTOSETPARENT is set
 		*/
 		if ($this->xavoidLoops || (MINIXML_AUTOSETPARENT > 0) )
 		{
 			if ($this->xparent == $child)
 			{
-
+				
 				$cname = $child->name();
-				return _MiniXMLError("MiniXMLElement::prependChild() Tryng to append parent $cname as child of "
+				return _MiniXMLError("MiniXMLElement::prependChild() Tryng to append parent $cname as child of " 
 							. $this->xname );
 			}
 			$child->parent($this);
 		}
-
-
+		
+		
 		$this->xnumElementChildren++; /* Note that we're adding a MiniXMLElement child */
-
+		
 		/* Add the child to the list */
 		$idx = $this->xnumChildren++;
 		array_unshift($this->xchildren, $child);
 		return $this->xchildren[0];
-
+		
 	} /* end method prependChild */
-
+	
 	function _validateChild (&$child)
 	{
-
+	
 		if (is_null($child))
 		{
 			return  _MiniXMLError("MiniXMLElement::_validateChild() need to pass a non-NULL MiniXMLElement child.");
 		}
-
-		if (! method_exists($child, 'MiniXMLElement'))
+		
+		if (!$child->iselement)
 		{
 			return _MiniXMLError("MiniXMLElement::_validateChild() must pass a MiniXMLElement object to _validateChild.");
 		}
-
+		
 		/* Make sure element is named */
 		$cname = $child->name();
 		if (is_null($cname))
@@ -811,8 +812,8 @@ class MiniXMLElement extends MiniXMLTree
 			_MiniXMLLog("MiniXMLElement::_validateChild() children must be named");
 			return 0;
 		}
-
-
+		
+		
 		/* Check for loops */
 		if ($child == $this)
 		{
@@ -824,11 +825,11 @@ class MiniXMLElement extends MiniXMLTree
 						. "while avoidLoops is on - aborting");
 			return 0;
 		}
-
+		
 		return 1;
 	}
 	/* createChild ELEMENTNAME [VALUE]
-	**
+	** 
 	** Creates a new MiniXMLElement instance and appends it to the list
 	** of this element's children.
 	** The new child element's name is set to ELEMENTNAME.
@@ -850,16 +851,14 @@ class MiniXMLElement extends MiniXMLTree
 		{
 			return _MiniXMLError("MiniXMLElement::createChild() Must pass a NAME to createChild.");
 		}
-
+		
 		if (! is_string($name))
 		{
 			return _MiniXMLError("MiniXMLElement::createChild() Name of child must be a STRING");
 		}
-
-		$child = new MiniXMLElement($name);
-
-		$appendedChild =& $this->appendChild($child);
-
+		
+		$appendedChild =& $this->appendChild(new MiniXMLElement($name));
+		
 		if (! $appendedChild )
 		{
 			_MiniXMLLog("MiniXMLElement::createChild() '$name' child NOT appended.");
@@ -876,21 +875,21 @@ class MiniXMLElement extends MiniXMLTree
 				$appendedChild->text($value);
 			}
 		}
-
+		
 		$appendedChild->avoidLoops($this->xavoidLoops);
-
+		
 		return $appendedChild;
-
+		
 	} /* end method createChild */
-
-
-
+	
+	
+	
 	/* removeChild CHILD
 	** Removes CHILD from this element's list of children.
 	**
 	** Returns the removed child, if found, NULL otherwise.
 	*/
-
+		
 	function &removeChild (&$child)
 	{
 		if (! $this->xnumChildren)
@@ -901,7 +900,7 @@ class MiniXMLElement extends MiniXMLTree
 			}
 			return NULL;
 		}
-
+		
 		$foundChild = NULL;
 		$idx = 0;
 		while ($idx < $this->xnumChildren && ! $foundChild)
@@ -913,7 +912,7 @@ class MiniXMLElement extends MiniXMLTree
 				$idx++;
 			}
 		}
-
+		
 		if (! $foundChild)
 		{
 			if (MINIXML_DEBUG > 0)
@@ -922,20 +921,20 @@ class MiniXMLElement extends MiniXMLTree
 			}
 			return NULL;
 		}
-
+		
 		array_splice($this->xchildren, $idx, 1);
-
+		
 		$this->xnumChildren--;
 		if ($this->isElement($foundChild))
 		{
 			$this->xnumElementChildren--;
 		}
-
+		
 		unset ($foundChild->xparent) ;
 		return $foundChild;
 	}
-
-
+	
+	
 	/* removeAllChildren
 	** Removes all children of this element.
 	**
@@ -944,46 +943,47 @@ class MiniXMLElement extends MiniXMLTree
 	function &removeAllChildren ()
 	{
 		$emptyArray = array();
-
+		
 		if (! $this->xnumChildren)
 		{
 			return $emptyArray;
 		}
-
+		
 		$retList =& $this->xchildren;
-
+		
 		$idx = 0;
 		while ($idx < $this->xnumChildren)
 		{
 			unset ($retList[$idx++]->xparent);
 		}
-
+		
+		unset($this->xchildren);
 		$this->xchildren = array();
 		$this->xnumElementChildren = 0;
 		$this->xnumChildren = 0;
-
-
+		
+		
 		return $retList;
 	}
-
-
+	
+		
 	function & remove ()
 	{
 		$parent =& $this->parent();
-
+		
 		if (!$parent)
 		{
 			_MiniXMLLog("XML::Mini::Element::remove() called for element with no parent set.  Aborting.");
 			return NULL;
 		}
-
+		
 		$removed =& $parent->removeChild($this);
-
+		
 		return $removed;
 	}
-
-
-
+		
+	
+	
 	/* parent NEWPARENT
 	**
 	** The parent() method is used to get/set the element's parent.
@@ -995,10 +995,10 @@ class MiniXMLElement extends MiniXMLTree
 	**
 	** Note: This method is mainly used internally and you wouldn't normally need
 	** to use it.
-	** It get's called on element appends when MINIXML_AUTOSETPARENT or
+	** It get's called on element appends when MINIXML_AUTOSETPARENT or 
 	** MINIXML_AVOIDLOOPS or avoidLoops() > 1
 	**
-	*/
+	*/ 
 	function &parent (&$setParent)
 	{
 		if (! is_null($setParent))
@@ -1010,12 +1010,12 @@ class MiniXMLElement extends MiniXMLTree
 			}
 			$this->xparent = $setParent;
 		}
-
+		
 		return $this->xparent;
-
+		
 	} /* end method parent */
-
-
+	
+	
 	/* avoidLoops SETTO
 	**
 	** The avoidLoops() method is used to get or set the avoidLoops flag for this element.
@@ -1025,7 +1025,7 @@ class MiniXMLElement extends MiniXMLTree
 	** in the heirarchy.
 	**
 	** The avoidLoops default behavior is configured with the MINIXML_AVOIDLOOPS define but can be
-	** set on individual elements (and automagically all the element's children) with the
+	** set on individual elements (and automagically all the element's children) with the 
 	** avoidLoops() method.
 	**
 	** Returns the current value of the avoidLoops flag for the element.
@@ -1037,13 +1037,13 @@ class MiniXMLElement extends MiniXMLTree
 		{
 			$this->xavoidLoops = $setTo;
 		}
-
+		
 		return $this->xavoidLoops;
 	}
-
-
+	
+	
 	/* toString [SPACEOFFSET]
-	**
+	** 
 	** toString returns an XML string based on the element's attributes,
 	** and content (recursively doing the same for all children)
 	**
@@ -1051,7 +1051,7 @@ class MiniXMLElement extends MiniXMLTree
 	** after newlines for elements at this level (adding 1 space per level in
 	** depth).  SPACEOFFSET defaults to 0.
 	**
-	** If SPACEOFFSET is passed as MINIXML_NOWHITESPACES.
+	** If SPACEOFFSET is passed as MINIXML_NOWHITESPACES.  
 	** no \n or whitespaces will be inserted in the xml string
 	** (ie it will all be on a single line with no spaces between the tags.
 	**
@@ -1067,7 +1067,7 @@ class MiniXMLElement extends MiniXMLTree
 	** calling the appropriate With/No WhiteSpaces toString on it's children - thereby
 	** avoiding the test on SPACEOFFSET
 	*/
-
+	
 	function toString ($depth=0)
 	{
 		if ($depth == MINIXML_NOWHITESPACES)
@@ -1077,50 +1077,50 @@ class MiniXMLElement extends MiniXMLTree
 			return $this->toStringWithWhiteSpaces($depth);
 		}
 	}
-
+	
 	function toStringWithWhiteSpaces ($depth=0)
 	{
 		$attribString = '';
 		$elementName = $this->xname;
 		$spaces = $this->_spaceStr($depth) ;
-
+		
 		$retString = "$spaces<$elementName";
-
-
+		
+		
 		foreach ($this->xattributes as $attrname => $attrvalue)
 		{
 			$attribString .= "$attrname=\"$attrvalue\" ";
 		}
-
-
+		
+		
 		if ($attribString)
 		{
 			$attribString = rtrim($attribString);
 			$retString .= " $attribString";
 		}
-
+		
 		if (! $this->xnumChildren)
 		{
 			/* No kids -> no sub-elements, no text, nothing - consider a <unary/> element */
 			$retString .= " />\n";
-
+			
 			return $retString;
-		}
-
-
-
+		} 
+		
+		
+		
 		/* If we've gotten this far, the element has
-		** kids or text - consider a <binary>otherstuff</binary> element
+		** kids or text - consider a <binary>otherstuff</binary> element 
 		*/
-
+		
 		$onlyTxtChild = 0;
 		if ($this->xnumChildren == 1 && ! $this->xnumElementChildren)
 		{
 			$onlyTxtChild = 1;
 		}
-
-
-
+		
+		
+		
 		if ($onlyTxtChild)
 		{
 			$nextDepth = 0;
@@ -1129,34 +1129,34 @@ class MiniXMLElement extends MiniXMLTree
 			$nextDepth = $depth+1;
 			$retString .= ">\n";
 		}
-
-
-
+		
+		
+		
 		for ($i=0; $i < $this->xnumChildren ; $i++)
 		{
 			if (method_exists($this->xchildren[$i], 'toStringWithWhiteSpaces') )
 			{
-
+			
 				$newStr = $this->xchildren[$i]->toStringWithWhiteSpaces($nextDepth);
-
-
+				
+					
 				if (! is_null($newStr))
 				{
 					if (! ( preg_match("/\n\$/", $newStr) || $onlyTxtChild) )
 					{
 						$newStr .= "\n";
 					}
-
+				
 					$retString .= $newStr;
 				}
-
+				
 			} else {
 				_MiniXMLLog("Invalid child found in $elementName ". $this->xchildren[$i]->name() );
-
+				
 			} /* end if has a toString method */
-
+			
 		} /* end loop over all children */
-
+		
 		/* add the indented closing tag */
 		if ($onlyTxtChild)
 		{
@@ -1165,147 +1165,147 @@ class MiniXMLElement extends MiniXMLTree
 			$retString .= "$spaces</$elementName>\n";
 		}
 		return $retString;
-
+		
 	} /* end method toString */
-
-
-
-
+	
+	
+	
+	
 	function toStringNoWhiteSpaces ()
 	{
 		$retString = '';
 		$attribString = '';
 		$elementName = $this->xname;
-
+		
 		foreach ($this->xattributes as $attrname => $attrvalue)
 		{
 			$attribString .= "$attrname=\"$attrvalue\" ";
 		}
-
+		
 		$retString = "<$elementName";
-
-
+		
+		
 		if ($attribString)
 		{
 			$attribString = rtrim($attribString);
 			$retString .= " $attribString";
 		}
-
+		
 		if (! $this->xnumChildren)
 		{
 			/* No kids -> no sub-elements, no text, nothing - consider a <unary/> element */
-
+			
 			$retString .= " />";
 			return $retString;
 		}
-
-
+		
+		
 		/* If we've gotten this far, the element has
-		** kids or text - consider a <binary>otherstuff</binary> element
+		** kids or text - consider a <binary>otherstuff</binary> element 
 		*/
 		$retString .= ">";
-
+		
 		/* Loop over all kids, getting associated strings */
 		for ($i=0; $i < $this->xnumChildren ; $i++)
 		{
 			if (method_exists($this->xchildren[$i], 'toStringNoWhiteSpaces') )
 			{
 				$newStr = $this->xchildren[$i]->toStringNoWhiteSpaces();
-
+					
 				if (! is_null($newStr))
 				{
 					$retString .= $newStr;
 				}
-
+				
 			} else {
 				_MiniXMLLog("Invalid child found in $elementName");
-
+				
 			} /* end if has a toString method */
-
+			
 		} /* end loop over all children */
-
+		
 		/* add the indented closing tag */
 		$retString .= "</$elementName>";
-
+		
 		return $retString;
-
+		
 	} /* end method toStringNoWhiteSpaces */
-
-
+	
+	
 	/* toStructure
 	**
 	** Converts an element to a structure - either an array or a simple string.
-	**
+	** 
 	** This method is used by MiniXML documents to perform their toArray() magic.
 	*/
 	function & toStructure ()
 	{
-
+	
 		$retHash = array();
 		$contents = "";
 		$numAdded = 0;
-
-
-
+		
+		
+		
 		for($i=0; $i< $this->xnumChildren; $i++)
 		{
 			if ($this->isElement($this->xchildren[$i]))
 			{
 				$name = $this->xchildren[$i]->name();
-
+				
 				if (array_key_exists($name, $retHash))
-
+				
 				{
 					if (! (is_array($retHash[$name]) && array_key_exists('_num', $retHash[$name])) )
 					{
 						$retHash[$name] = array($retHash[$name],
 									 $this->xchildren[$i]->toStructure());
-
+									 
 						$retHash[$name]['_num'] = 2;
 					} else {
 						array_push($retHash[$name], $this->xchildren[$i]->toStructure() );
-
+						
 						$retHash[$name]['_num']++;
 					}
 				} else {
 					$retHash[$name] = $this->xchildren[$i]->toStructure();
 				}
-
+			
 				$numAdded++;
 			} else {
 				$contents .= $this->xchildren[$i]->getValue();
 			}
-
-
+			
+		
 		}
-
-
+		
+		
 		foreach ($this->xattributes as $attrname => $attrvalue)
 		{
 			#array_push($retHash, array($attrname => $attrvalue));
 			$retHash["_attributes"][$attrname] = $attrvalue;
 			$numAdded++;
 		}
-
-
+		
+		
 		if ($numAdded)
 		{
 			if (! empty($contents))
 			{
 				$retHash['_content'] = $contents;
 			}
-
+			
 			return $retHash;
 		} else {
 			return $contents;
 		}
-
+		
 	} // end toStructure() method
-
-
-
-
-
+	
+	
+	
+	
+	
 	/* isElement ELEMENT
 	** Returns a true value if ELEMENT is an instance of MiniXMLElement,
 	** false otherwise.
@@ -1318,11 +1318,11 @@ class MiniXMLElement extends MiniXMLTree
 		{
 			return 0;
 		}
-
+		
 		return method_exists($testme, 'MiniXMLElement');
 	}
-
-
+	
+	
 	/* isNode NODE
 	** Returns a true value if NODE is an instance of MiniXMLNode,
 	** false otherwise.
@@ -1335,15 +1335,15 @@ class MiniXMLElement extends MiniXMLTree
 		{
 			return 0;
 		}
-
+		
 		return method_exists($testme, 'MiniXMLNode');
 	}
-
-
+	
+	
 	/* createNode NODEVALUE [ESCAPEENTITIES]
 	**
 	** Private (?)
-	**
+	** 
 	** Creates a new MiniXMLNode instance and appends it to the list
 	** of this element's children.
 	** The new child node's value is set to NODEVALUE.
@@ -1356,15 +1356,12 @@ class MiniXMLElement extends MiniXMLTree
 	*/
 	function & createNode (&$value, $escapeEntities=NULL)
 	{
+		
+		return $this->appendNode(new MiniXMLNode($value, $escapeEntities));
 
-		$newNode = new MiniXMLNode($value, $escapeEntities);
-
-		$appendedNode =& $this->appendNode($newNode);
-
-		return $appendedNode;
 	}
-
-
+		
+	
 	/* appendNode CHILDNODE
 	**
 	** appendNode is used to append an existing MiniXMLNode object to
@@ -1382,40 +1379,44 @@ class MiniXMLElement extends MiniXMLTree
 		{
 			return  _MiniXMLError("MiniXMLElement::appendNode() need to pass a non-NULL MiniXMLNode.");
 		}
-
-
-		if (! method_exists($node, 'MiniXMLNode'))
+		
+		
+		if (! $node->isnode)
 		{
 			return _MiniXMLError("MiniXMLElement::appendNode() must pass a MiniXMLNode object to appendNode.");
 		}
-
+		
 		if (MINIXML_AUTOSETPARENT)
 		{
 			if ($this->xparent == $node)
 			{
-				return _MiniXMLError("MiniXMLElement::appendnode() Tryng to append parent $cname as node of "
+				return _MiniXMLError("MiniXMLElement::appendnode() Tryng to append parent $cname as node of " 
 							. $this->xname );
 			}
 			$node->parent($this);
 		}
-
-
+		
+		
 		$idx = $this->xnumChildren++;
-		$this->xchildren[$idx] = $node;
-
+		$this->xchildren[$idx] =& $node;
+		
 		return $this->xchildren[$idx];
-
-
+		
+		
 	}
-
+	
 	/* Destructor to keep things clean -- patch by Ilya */
 	function __destruct()
 	{
 		for ($i = 0; $i < count($this->xchildren); ++$i)
-			$this->xchildren[$i]->xparent = null;
+		{
+			// $this->xchildren[$i]->xparent = NULL;
+			unset($this->xchildren[$i]);
+		}
+		unset($this->xchildren);
 	}
-
-
+	
+	
 } /* end MiniXMLElement class definition */
 
 
@@ -1445,8 +1446,8 @@ class MiniXMLElementComment extends Mini
 	{
 		$this->MiniXMLElement('!--');
 	}
-
-
+	
+	
 	function toString ($depth=0)
 	{
 		if ($depth == MINIXML_NOWHITESPACES)
@@ -1456,66 +1457,66 @@ class MiniXMLElementComment extends Mini
 			return $this->toStringWithWhiteSpaces($depth);
 		}
 	}
-
-
+	
+		
 	function toStringWithWhiteSpaces ($depth=0)
 	{
 
 		$spaces = $this->_spaceStr($depth) ;
-
+		
 		$retString = "$spaces<!-- \n";
-
+		
 		if (! $this->xnumChildren)
 		{
 			/* No kids, no text - consider a <unary/> element */
 			$retString .= " -->\n";
-
+			
 			return $retString;
 		}
-
+		
 		/* If we get here, the element does have children... get their contents */
-
+		
 		$nextDepth = $depth+1;
-
+		
 		for ($i=0; $i < $this->xnumChildren ; $i++)
 		{
 			$retString .= $this->xchildren[$i]->toStringWithWhiteSpaces($nextDepth);
 		}
-
+		
 		$retString .= "\n$spaces -->\n";
-
-
+		
+		
 		return $retString;
 	}
-
-
+	
+	
 	function toStringNoWhiteSpaces ()
 	{
 		$retString = '';
-
+		
 		$retString = "<!-- ";
-
+		
 		if (! $this->xnumChildren)
 		{
 			/* No kids, no text - consider a <unary/> element */
 			$retString .= " -->";
 			return $retString;
 		}
-
-
+		
+		
 		/* If we get here, the element does have children... get their contents */
 		for ($i=0; $i < $this->xnumChildren ; $i++)
 		{
 			$retString .= $this->xchildren[$i]->toStringNoWhiteSpaces();
 		}
-
+		
 		$retString .= " -->";
-
-
+		
+		
 		return $retString;
 	}
-
-
+		
+	
 }
 
 
@@ -1539,30 +1540,30 @@ class MiniXMLElementComment extends Mini
 
 class MiniXMLElementCData extends MiniXMLElement {
 
-
-
-
+		
+	
+	
 	function MiniXMLElementCData ($contents)
 	{
-
+		
 		$this->MiniXMLElement('CDATA');
 		if (! is_null($contents))
 		{
 			$this->createNode($contents, 0) ;
 		}
 	}
-
+	
 
 	function toStringNoWhiteSpaces ()
 	{
 		return $this->toString(MINIXML_NOWHITESPACES);
 	}
-
+	
 	function toStringWithWhiteSpaces ($depth=0)
 	{
 		return $this->toString($depth);
 	}
-
+	
 	function toString ($depth=0)
 	{
 		$spaces = '';
@@ -1570,26 +1571,26 @@ class MiniXMLElementCData extends MiniXM
 		{
 			$spaces = $this->_spaceStr($depth);
 		}
-
+		
 		$retString = "$spaces<![CDATA[ ";
-
+		
 		if (! $this->xnumChildren)
 		{
 			$retString .= "]]>\n";
 			return $retString;
 		}
-
+		
 		for ( $i=0; $i < $this->xnumChildren; $i++)
 		{
 			$retString .= $this->xchildren[$i]->getValue();
-
+			
 		}
-
+		
 		$retString .= " ]]>\n";
-
+		
 		return $retString;
 	}
-
+	
 
 
 }
@@ -1613,7 +1614,7 @@ class MiniXMLElementCData extends MiniXM
 class MiniXMLElementDocType extends MiniXMLElement {
 
 	var $dtattr;
-
+	
 	function MiniXMLElementDocType ($attr)
 	{
 		$this->MiniXMLElement('DOCTYPE');
@@ -1628,56 +1629,56 @@ class MiniXMLElementDocType extends Mini
 			return $this->toStringWithWhiteSpaces($depth);
 		}
 	}
-
-
+	
+		
 	function toStringWithWhiteSpaces ($depth=0)
 	{
 
 		$spaces = $this->_spaceStr($depth);
-
+		
 		$retString = "$spaces<!DOCTYPE " . $this->dtattr . " [\n";
-
+		
 		if (! $this->xnumChildren)
 		{
 			$retString .= "]>\n";
 			return $retString;
 		}
-
+		
 		$nextDepth = $depth + 1;
-
+		
 		for ( $i=0; $i < $this->xnumChildren; $i++)
 		{
-
+			
 			$retString .= $this->xchildren[$i]->toStringWithWhiteSpaces($nextDepth);
-
+			
 		}
-
+		
 		$retString .= "\n$spaces]>\n";
-
+		
 		return $retString;
 	}
 
 
 	function toStringNoWhiteSpaces ()
 	{
-
+	
 		$retString = "<!DOCTYPE " . $this->dtattr . " [ ";
-
+		
 		if (! $this->xnumChildren)
 		{
 			$retString .= "]>\n";
 			return $retString;
 		}
-
+		
 		for ( $i=0; $i < $this->xnumChildren; $i++)
 		{
-
+			
 			$retString .= $this->xchildren[$i]->toStringNoWhiteSpaces();
-
+			
 		}
-
+		
 		$retString .= " ]>\n";
-
+		
 		return $retString;
 	}
 
@@ -1704,57 +1705,57 @@ class MiniXMLElementDocType extends Mini
 class MiniXMLElementEntity extends MiniXMLElement {
 
 
-
+	
 	function MiniXMLElementEntity  ($name, $value=NULL)
 	{
-
+		
 		$this->MiniXMLElement($name);
-
+		
 		if (! is_null ($value))
 		{
 			$this->createNode($value, 0);
 		}
-
+		
 	}
-
+	
 	function toString ($depth = 0)
 	{
-
+		
 		$spaces = '';
 		if ($depth != MINIXML_NOWHITESPACES)
 		{
 			$spaces = $this->_spaceStr($depth);
-		}
-
+		} 
+		
 		$retString = "$spaces<!ENTITY " . $this->name();
-
+		
 		if (! $this->xnumChildren)
 		{
 			$retString .= ">\n";
 			return $retString;
 		}
-
+		
 		 $nextDepth = ($depth == MINIXML_NOWHITESPACES) ? MINIXML_NOWHITESPACES
 										: $depth + 1;
 		$retString .= '"';
 		for ( $i=0; $i < $this->xnumChildren; $i++)
 		{
-
+			
 			$retString .= $this->xchildren[$i]->toString(MINIXML_NOWHITESPACES);
-
+			
 		}
 		$retString .= '"';
 		$retString .= " >\n";
-
+		
 		return $retString;
 	}
-
-
+	
+	
 	function toStringNoWhiteSpaces ()
 	{
 		return $this->toString(MINIXML_NOWHITESPACES);
 	}
-
+	
 	function toStringWithWhiteSpaces ($depth=0)
 	{
 		return $this->toString($depth);
Index: libraries/minixml/classes/node.inc.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/libraries/minixml/classes/node.inc.php,v
retrieving revision 1.1
diff -u -p -r1.1 node.inc.php
--- libraries/minixml/classes/node.inc.php	9 Jun 2006 16:43:28 -0000	1.1
+++ libraries/minixml/classes/node.inc.php	17 Apr 2009 02:09:04 -0000
@@ -12,31 +12,37 @@
 ****************************************************************************************************
 *****
 *****      MiniXML - PHP class library for generating and parsing XML.
-*****
+*****                                            
 *****      Copyright (C) 2002-2005 Patrick Deegan, Psychogenic.com
 *****      All rights reserved.
 *****
-*****      http://minixml.psychogenic.com
-*****
-*****   This program is free software; you can redistribute
-*****   it and/or modify it under the terms of the GNU
-*****   General Public License as published by the Free
-*****   Software Foundation; either version 2 of the
-*****   License, or (at your option) any later version.
-*****
-*****   This program is distributed in the hope that it will
-*****   be useful, but WITHOUT ANY WARRANTY; without even
-*****   the implied warranty of MERCHANTABILITY or FITNESS
-*****   FOR A PARTICULAR PURPOSE.  See the GNU General
-*****   Public License for more details.
-*****
-*****   You should have received a copy of the GNU General
-*****   Public License along with this program; if not,
-*****   write to the Free Software Foundation, Inc., 675
-*****   Mass Ave, Cambridge, MA 02139, USA.
+*****      http://minixml.psychogenic.com    
 *****
+*****   
+*****   This library is released under the terms of the GNU GPL version 3, making it available only for 
+*****   free programs ("free" here being used in the sense of the GPL, see http://www.gnu.org for more details). 
+*****   Anyone wishing to use this library within a proprietary or otherwise non-GPLed program MUST contact psychogenic.com to 
+*****   acquire a distinct license for their application.  This approach encourages the use of free software 
+*****   while allowing for proprietary solutions that support further development.
+*****   
+*****   
+*****   
+*****   miniXML is free software: you can redistribute it and/or modify
+*****   it under the terms of the GNU General Public License as published by
+*****   the Free Software Foundation, either version 3 of the License, or
+*****   (at your option) any later version.
+*****
+*****   miniXML is distributed in the hope that it will be useful,
+*****   but WITHOUT ANY WARRANTY; without even the implied warranty of
+*****   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*****   GNU General Public License for more details.
+*****
+*****   You should have received a copy of the GNU General Public License
+*****   along with miniXML.  If not, see <http://www.gnu.org/licenses/>.
+*****   
+*****   
 *****
-*****   You may contact the author, Pat Deegan, through the
+*****   You may contact the author, Pat Deegan, through the     
 *****   contact section at http://www.psychogenic.com
 *****
 *****   Much more information on using this API can be found on the
@@ -67,10 +73,10 @@ require_once(MINIXML_CLASSDIR . "/treeco
 ** They have no name or children.
 **
 ** They always exist as children of MiniXMLElements.
-** For example,
+** For example, 
 ** <B>this text is bold</B>
 ** Would be represented as a MiniXMLElement named 'B' with a single
-** child, a MiniXMLNode object which contains the string 'this text
+** child, a MiniXMLNode object which contains the string 'this text 
 ** is bold'.
 **
 ** a MiniXMLNode has
@@ -79,10 +85,11 @@ require_once(MINIXML_CLASSDIR . "/treeco
 */
 
 class MiniXMLNode extends MiniXMLTreeComponent {
-
-
+	
+	
 	var $xtext;
 	var $xnumeric;
+	var $xisnode;
 
 	/* MiniXMLNode [CONTENTS]
 	** Constructor.  Creates a new MiniXMLNode object.
@@ -93,8 +100,9 @@ class MiniXMLNode extends MiniXMLTreeCom
 		$this->MiniXMLTreeComponent();
 		$this->xtext = NULL;
 		$this->xnumeric = NULL;
-
-		/* If we were passed a value, save it as the
+		$this->isnode = 1;
+		
+		/* If we were passed a value, save it as the 
 		** appropriate type
 		*/
 		if (! is_null($value))
@@ -105,7 +113,7 @@ class MiniXMLNode extends MiniXMLTreeCom
 				{
 					_MiniXMLLog("Setting numeric value of node to '$value'");
 				}
-
+			
 				$this->xnumeric = $value;
 			} else {
 				if (MINIXML_IGNOREWHITESPACES > 0)
@@ -113,33 +121,29 @@ class MiniXMLNode extends MiniXMLTreeCom
 					$value = trim($value);
 					$value = rtrim($value);
 				}
-
-				if (! is_null($escapeEntities))
+				
+				if ($escapeEntities || (MINIXML_AUTOESCAPE_ENTITIES > 0))
 				{
-					if ($escapeEntities)
-					{
-						$value = htmlentities($value);
-					}
-				} elseif (MINIXML_AUTOESCAPE_ENTITIES > 0) {
 					$value = htmlentities($value);
+				
 				}
-
+				
 				if (MINIXML_DEBUG > 0)
 				{
 					_MiniXMLLog("Setting text value of node to '$value'");
 				}
-
+				
 				$this->xtext = $value;
-
-
+			
+				
 			} /* end if value numeric */
-
+			
 		} /* end if value passed */
-
+			
 	} /* end MiniXMLNode constructor */
-
+	
 	/* getValue
-	**
+	** 
 	** Returns the text or numeric value of this Node.
 	*/
 	function getValue ()
@@ -152,133 +156,133 @@ class MiniXMLNode extends MiniXMLTreeCom
 		{
 			$retStr = "$this->xnumeric";
 		}
-
+		
 		if (MINIXML_DEBUG > 0)
 		{
 			_MiniXMLLog("MiniXMLNode::getValue returning '$retStr'");
 		}
-
+		
 		return $retStr;
 	}
-
-
+	
+	
 	/* text [SETTO [SETTOALT]]
 	**
 	** The text() method is used to get or set text data for this node.
 	**
 	** If SETTO is passed, the node's content is set to the SETTO string.
 	**
-	** If the optional SETTOALT is passed and SETTO is false, the
-	** node's value is set to SETTOALT.
+	** If the optional SETTOALT is passed and SETTO is false, the 
+	** node's value is set to SETTOALT.  
 	**
-	** Returns this node's text, if set or NULL
+	** Returns this node's text, if set or NULL 
 	**
 	*/
 	function text ($setToPrimary = NULL, $setToAlternate=NULL)
 	{
 		$setTo = ($setToPrimary ? $setToPrimary : $setToAlternate);
-
+		
 		if (! is_null($setTo))
 		{
-			if (! is_null($this->xnumeric) )
+			if (! is_null($this->xnumeric) ) 
 			{
 				return _MiniXMLError("MiniXMLNode::text() Can't set text for element with numeric set.");
-
+				
 			} elseif (! is_string($setTo) && ! is_numeric($setTo) ) {
-
+			
 				return _MiniXMLError("MiniXMLNode::text() Must pass a STRING value to set text for element ('$setTo').");
 			}
-
+			
 			if (MINIXML_IGNOREWHITESPACES > 0)
 			{
 				$setTo = trim($setTo);
 				$setTo = rtrim($setTo);
 			}
-
-
+			
+			
 			if (MINIXML_AUTOESCAPE_ENTITIES > 0)
 			{
 				$setTo = htmlentities($setTo);
-			}
-
-
+			} 
+			
+			
 			if (MINIXML_DEBUG > 0)
 			{
 				_MiniXMLLog("Setting text value of node to '$setTo'");
 			}
-
+			
 			$this->xtext = $setTo;
-
+			
 		}
-
+		
 		return $this->xtext;
 	}
-
+	
 	/* numeric [SETTO [SETTOALT]]
 	**
 	** The numeric() method is used to get or set numerical data for this node.
 	**
 	** If SETTO is passed, the node's content is set to the SETTO string.
 	**
-	** If the optional SETTOALT is passed and SETTO is NULL, the
-	** node's value is set to SETTOALT.
+	** If the optional SETTOALT is passed and SETTO is NULL, the 
+	** node's value is set to SETTOALT.  
 	**
-	** Returns this node's text, if set or NULL
+	** Returns this node's text, if set or NULL 
 	**
 	*/
 	function numeric ($setToPrim = NULL, $setToAlt = NULL)
 	{
 		$setTo = is_null($setToPrim) ? $setToAlt : $setToPrim;
-
+		
 		if (! is_null($setTo))
 		{
 			if (! is_null($this->xtext)) {
-
+			
 				return _MiniXMLError("MiniXMLElement::numeric() Can't set numeric for element with text.");
-
+			
 			} elseif (! is_numeric($setTo))
 			{
 				return _MiniXMLError("MiniXMLElement::numeric() Must pass a NUMERIC value to set numeric for element.");
 			}
-
+			
 			if (MINIXML_DEBUG > 0)
 			{
 				_MiniXMLLog("Setting numeric value of node to '$setTo'");
 			}
 			$this->xnumeric = $setTo;
 		}
-
+		
 		return $this->xnumeric;
 	}
-
-
-
+	
+	
+	
 	/* toString [DEPTH]
 	**
 	** Returns this node's contents as a string.
 	**
 	**
-	** Note: Nodes have only a single value, no children.  It is
-	** therefore pointless to use the same toString() method split as
+	** Note: Nodes have only a single value, no children.  It is 
+	** therefore pointless to use the same toString() method split as 
 	** in the MiniXMLElement class.
 	**
 	*/
-
+	
 	function toString ($depth=0)
 	{
 		if ($depth == MINIXML_NOWHITESPACES)
 		{
 			return $this->toStringNoWhiteSpaces();
 		}
-
+		
 		if (MINIXML_DEBUG > 0)
 		{
 			_MiniXMLLog("MiniXMLNode::toString() call with depth $depth");
 		}
-
+		
 		$spaces = $this->_spaceStr($depth);
 		$retStr = $spaces;
-
+		
 		if (! is_null($this->xtext) )
 		{
 			/* a text element */
@@ -286,28 +290,28 @@ class MiniXMLNode extends MiniXMLTreeCom
 		} elseif (! is_null($this->xnumeric)) {
 			/* a numeric element */
 			$retStr .=  $this->xnumeric;
-		}
-
+		} 
+		
 		/* indent all parts of the string correctly */
 		$retStr = preg_replace("/\n\s*/sm", "\n$spaces", $retStr);
-
+		
 		return $retStr;
 	}
-
-
+	
+	
 	function toStringWithWhiteSpaces ($depth=0)
 	{
 		return $this->toString($depth);
 	}
-
+	
 	function toStringNoWhiteSpaces ()
 	{
-
+	
 		if (MINIXML_DEBUG > 0)
 		{
 			_MiniXMLLog("MiniXMLNode::toStringNoWhiteSpaces() call with depth $depth");
 		}
-
+		
 		if (! is_null($this->xtext) )
 		{
 			/* a text element */
@@ -316,13 +320,11 @@ class MiniXMLNode extends MiniXMLTreeCom
 			/* a numeric element */
 			$retStr =  $this->xnumeric;
 		}
-
+		
 		return $retStr;
 	}
-
-
+	
+	
 } /* end class definition */
 
-
-
 ?>
Index: libraries/minixml/classes/treecomp.inc.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/libraries/minixml/classes/treecomp.inc.php,v
retrieving revision 1.1
diff -u -p -r1.1 treecomp.inc.php
--- libraries/minixml/classes/treecomp.inc.php	9 Jun 2006 16:43:28 -0000	1.1
+++ libraries/minixml/classes/treecomp.inc.php	17 Apr 2009 02:09:04 -0000
@@ -11,31 +11,36 @@
 ****************************************************************************************************
 *****
 *****      MiniXML - PHP class library for generating and parsing XML.
-*****
+*****                                            
 *****      Copyright (C) 2002-2005 Patrick Deegan, Psychogenic.com
 *****      All rights reserved.
 *****
-*****      http://minixml.psychogenic.com
-*****
-*****   This program is free software; you can redistribute
-*****   it and/or modify it under the terms of the GNU
-*****   General Public License as published by the Free
-*****   Software Foundation; either version 2 of the
-*****   License, or (at your option) any later version.
-*****
-*****   This program is distributed in the hope that it will
-*****   be useful, but WITHOUT ANY WARRANTY; without even
-*****   the implied warranty of MERCHANTABILITY or FITNESS
-*****   FOR A PARTICULAR PURPOSE.  See the GNU General
-*****   Public License for more details.
-*****
-*****   You should have received a copy of the GNU General
-*****   Public License along with this program; if not,
-*****   write to the Free Software Foundation, Inc., 675
-*****   Mass Ave, Cambridge, MA 02139, USA.
-*****
+*****      http://minixml.psychogenic.com    
 *****
-*****   You may contact the author, Pat Deegan, through the
+*****   
+*****   This library is released under the terms of the GNU GPL version 3, making it available only for 
+*****   free programs ("free" here being used in the sense of the GPL, see http://www.gnu.org for more details). 
+*****   Anyone wishing to use this library within a proprietary or otherwise non-GPLed program MUST contact psychogenic.com to 
+*****   acquire a distinct license for their application.  This approach encourages the use of free software 
+*****   while allowing for proprietary solutions that support further development.
+*****   
+*****   
+*****   
+*****   miniXML is free software: you can redistribute it and/or modify
+*****   it under the terms of the GNU General Public License as published by
+*****   the Free Software Foundation, either version 3 of the License, or
+*****   (at your option) any later version.
+*****
+*****   miniXML is distributed in the hope that it will be useful,
+*****   but WITHOUT ANY WARRANTY; without even the implied warranty of
+*****   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*****   GNU General Public License for more details.
+*****
+*****   You should have received a copy of the GNU General Public License
+*****   along with miniXML.  If not, see <http://www.gnu.org/licenses/>.
+*****   
+*****   
+*****   You may contact the author, Pat Deegan, through the     
 *****   contact section at http://www.psychogenic.com
 *****
 *****   Much more information on using this API can be found on the
@@ -57,14 +62,14 @@
 
 
 
-/* MiniXMLTreeComponent class
+/* MiniXMLTreeComponent class 
 ** This class is only to be used as a base class
 ** for others.
 **
 ** It presents the minimal interface we can expect
 ** from any component in the XML hierarchy.
 **
-** All methods of this base class
+** All methods of this base class 
 ** simply return NULL except a little default functionality
 ** included in the parent() method.
 **
@@ -74,39 +79,39 @@
 */
 
 class MiniXMLTreeComponent {
-
+	
 	var $xparent;
-
+	
 	/*  MiniXMLTreeComponent
 	** Constructor.  Creates a new MiniXMLTreeComponent object.
 	**
 	*/
 	function MiniXMLTreeComponent ()
 	{
-		$this->xparent = NULL;
+		// $this->xparent = NULL;
 	} /* end MiniXMLTreeComponent constructor */
-
-
+	
+	
 	/* Get set function for the element name
 	*/
 	function name ($setTo=NULL)
 	{
 		return NULL;
 	}
-
+	
 	/* Function to fetch an element */
 	function & getElement ($name)
 	{
-		return NULL;
+		return _MiniXMLReturnNullByRef();
 	}
-
-	/* Function that returns the value of this
+	
+	/* Function that returns the value of this 
 	component and its children */
 	function getValue ()
 	{
 		return NULL;
 	}
-
+	
 	/* parent NEWPARENT
 	**
 	** The parent() method is used to get/set the element's parent.
@@ -117,7 +122,7 @@ class MiniXMLTreeComponent {
 	** Returns a reference to the parent MiniXMLTreeComponent if set, NULL otherwise.
 	*/
 	function &parent (&$setParent)
-	{
+	{	
 		if (! is_null($setParent))
 		{
 			/* Parents can only be MiniXMLElement objects */
@@ -128,12 +133,12 @@ class MiniXMLTreeComponent {
 			}
 			$this->xparent = $setParent;
 		}
-
+		
 		return $this->xparent;
-
-
+		
+		
 	}
-
+	
 	/* Return a stringified version of the XML representing
 	this component and all sub-components */
 	function toString ($depth=0)
@@ -149,7 +154,7 @@ class MiniXMLTreeComponent {
 	{
 		return var_dump($this);
 	}
-
+	
 	/* helper class that everybody loves */
 	function _spaceStr ($numSpaces)
 	{
@@ -158,23 +163,22 @@ class MiniXMLTreeComponent {
 		{
 			return $retStr;
 		}
-
+			
 		for($i = 1; $i < $numSpaces; $i++)
 		{
 			$retStr .= str_repeat(' ', MINIXML_INDENT_SIZE);
 		}
-
+		
 		return $retStr;
 	}
-
+	
 	/* Destructor to keep things clean -- patch by Ilya */
 	function __destruct()
 	{
 		$this->xparent = null;
 	}
-
+	
 } /* end class definition */
 
 
 ?>
-
Index: ui/importexportui.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/ui/importexportui.info,v
retrieving revision 1.4
diff -u -p -r1.4 importexportui.info
--- ui/importexportui.info	25 Mar 2007 21:21:47 -0000	1.4
+++ ui/importexportui.info	17 Apr 2009 02:09:04 -0000
@@ -2,4 +2,5 @@
 name = Import Export UI
 description = Provides a user interface for importing and exporting data in a Drupal site. Requires the importexportapi module.
 package = Import Export API
-dependencies = importexportapi
+dependencies[] = importexportapi
+core = 6.x
Index: ui/importexportui.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/importexportapi/ui/importexportui.module,v
retrieving revision 1.12
diff -u -p -r1.12 importexportui.module
--- ui/importexportui.module	25 Mar 2007 21:21:47 -0000	1.12
+++ ui/importexportui.module	17 Apr 2009 02:09:04 -0000
@@ -9,19 +9,19 @@
 /**
  * Implementation of hook_help().
  */
-function importexportui_help($section) {
+function importexportui_help($path, $arg) {
   $op = '';
 
-  if (strpos($section, 'admin/build/import') !== FALSE) {
-    $section = 'admin/build/import';
+  if (strpos($path, 'admin/build/import') !== FALSE) {
+    $path = 'admin/build/import';
     $op = 'import';
   }
-  elseif (strpos($section, 'admin/build/export') !== FALSE) {
-    $section = 'admin/build/export';
+  elseif (strpos($path, 'admin/build/export') !== FALSE) {
+    $path = 'admin/build/export';
     $op = 'export';
   }
 
-  switch ($section) {
+  switch ($path) {
     case 'admin/help#importexportui':
       return t('The import / export UI module provides a user interface for importing and exporting data in a Drupal site in a variety of formats. It requires the importexportapi module, which it relies on for performing all of the actual work of executing import and export operations.');
 
@@ -33,7 +33,6 @@ function importexportui_help($section) {
       if (!empty($entities)) {
         $page = 'field mappings';
       }
-
       return _importexportui_get_help_message($page, $op);
   }
 }
@@ -41,25 +40,22 @@ function importexportui_help($section) {
 /**
  * Implementation of hook_menu().
  */
-function importexportui_menu($may_cache) {
-  $items = array();
+function importexportui_menu() {
+  $items['admin/build/export'] = array(
+    'title' => 'Export',
+    'description' => 'Create a user interface for exporting data from the site.',
+    'page callback' => 'importexportui_page',
+    'page arguments' => array('export'),
+    'access arguments' => array('perform data exports')
+  );
 
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/build/export',
-      'title' => t('Export'),
-      'callback' => 'importexportui_page',
-      'callback arguments' => array('export'),
-      'access' => user_access('perform data exports')
-    );
-    $items[] = array(
-      'path' => 'admin/build/import',
-      'title' => t('Import'),
-      'callback' => 'importexportui_page',
-      'callback arguments' => array('import'),
-      'access' => user_access('perform data imports')
-    );
-  }
+  $items['admin/build/import'] = array(
+    'title' => 'Import',
+    'description' => 'Create a user interface for importing data to the site.',
+    'page callback' => 'importexportui_page',
+    'page arguments' => array('import'),
+    'access arguments' => array('perform data imports')
+  );
 
   return $items;
 }
@@ -87,9 +83,9 @@ function importexportui_page($op, $entit
  * The initial selection form that the user is presented with on the import and
  * export pages.
  */
-function importexportui_initial_selection_form($op) {
-  $form = array();
+function importexportui_initial_selection_form(&$form_state, $op) {
 
+  $form = array();
   $form['entities'] = array(
     '#type' => 'checkboxes',
     '#title' => t('Entities to @op', array('@op' => $op)),
@@ -116,27 +112,28 @@ function importexportui_initial_selectio
 /**
  * Redirects the user from the initial selection form to the mapping form page.
  */
-function importexportui_initial_selection_form_submit($form_id, $form_values) {
+function importexportui_initial_selection_form_submit($form, &$form_state) {
   $entities = NULL;
   $engine = NULL;
   $op = arg(2);
 
-  if (!empty($form_values['entities'])) {
-    $entities = implode(',', array_filter($form_values['entities']));
+  if (!empty($form_state['values']['entities'])) {
+    $entities = implode(',', array_filter($form_state['values']['entities']));
   }
-  if (!empty($form_values['engine'])) {
-    $engine = $form_values['engine'];
+  if (!empty($form_state['values']['engine'])) {
+    $engine = $form_state['values']['engine'];
   }
 
   if (!empty($entities) && !empty($engine)) {
-    return 'admin/build/'. $op .'/'. $entities .'/'. $engine;
+    $form_state['redirect'] = 'admin/build/'. $op .'/'. $entities .'/'. $engine;
+    $form_state['nid'] = $node->nid;
   }
 }
 
 /**
  * Displays the field mappings form.
  */
-function importexportui_mapping_form($op, $entity_list, $engine) {
+function importexportui_mapping_form(&$form_state, $op, $entity_list, $engine) {
   $form = array();
   $def = importexportapi_get_def(NULL, TRUE);
   $type = ($op == 'export' ? 'put' : 'get');
@@ -295,26 +292,28 @@ function _importexportui_mapping_form(&$
  * 'back'), or processes the user's custom-defined field mappings, and then
  * executes the import or export operation.
  */
-function importexportui_mapping_form_submit($form_id, $form_values) {
-  $op = isset($form_values['op']) ? $form_values['op'] : NULL;
+function importexportui_mapping_form_submit($form, &$form_state) {
+  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : NULL;
 
   if (!empty($op) && $op == t('Back (initial selection)')) {
-    return 'admin/build/'. $form_values['ie_op'];
+    $form_state['redirect'] = 'admin/build/'. $form_state['values']['ie_op'];
+    $form_state['nid'] = $node->nid;
+    exit();
   }
 
-  _importexportui_set_mappings($form_values);
+  _importexportui_set_mappings($form_state);
 
-  $function = 'importexportui_do_'. $form_values['ie_op'];
+  $function = 'importexportui_do_'. $form_state['values']['ie_op'];
 
   if (isset($op) && function_exists($function)) {
-    $function($form_values);
+    $function($form_state);
   }
 
   drupal_page_footer();
   exit();
 }
 
-function importexportui_export_form($entity_list, $engine) {
+function importexportui_export_form(&$form_state, $entity_list, $engine) {
   timer_start('importexportui');
   $data = importexportapi_get_data($entity_list);
   $ret = importexportapi_put_data($data, $engine);
@@ -360,40 +359,39 @@ function importexportui_export_form($ent
 /**
  * Performs an export operation, and outputs the results in a themed page.
  */
-function importexportui_do_export($form_values) {
-  $output .= drupal_get_form('importexportui_export_form', $form_values['entity_list'], $form_values['engine']);
-  $output .= _importexportui_view_links($form_values['ie_op']);
+function importexportui_do_export($form_state) {
+  $output .= drupal_get_form('importexportui_export_form', $form_state['values']['entity_list'], $form_state['values']['engine']);
+  $output .= _importexportui_view_links($form_state['values']['ie_op']);
   print theme('page', $output);
 }
 
 /**
  * Performs an import operation, and outputs the results in a themed page.
  */
-function importexportui_do_import($form_values) {
-  $entity_list = $form_values['entity_list'];
-  $engine = $form_values['engine'];
+function importexportui_do_import($form_state) {
+  $entity_list = $form_state['values']['entity_list'];
+  $engine = $form_state['values']['engine'];
   $raw = NULL;
 
   if ($engine == 'xml') {
-    $raw = _importexportui_get_raw_data($form_values['raw']);
+    $raw = _importexportui_get_raw_data($form_state['values']['raw']);
   }
   elseif ($engine == 'csv') {
     $raw = array();
-    $raw_list = $form_values['raw_list'];
+    $raw_list = $form_state['values']['raw_list'];
 
     foreach ($raw_list as $raw_item) {
-      if (!empty($form_values['raw_'. $raw_item['id']])) {
-        $raw[$raw_item['csv_plural']] = _importexportui_get_raw_data($form_values['raw_'. $raw_item['id']]);
+      if (!empty($form_state['values']['raw_'. $raw_item['id']])) {
+        $raw[$raw_item['csv_plural']] = _importexportui_get_raw_data($form_state['values']['raw_'. $raw_item['id']]);
       }
     }
   }
-
   $data = importexportapi_get_data($entity_list, $engine, array('raw' => $raw));
   $ret = importexportapi_put_data($data, NULL, array('put_id' => 1));
 
   $output = '<pre><code>'. check_plain("$ret") .'</code></pre>';;
 
-  $output .= _importexportui_view_links($form_values['ie_op']);
+  $output .= _importexportui_view_links($form_state['values']['ie_op']);
   print theme('page', $output);
 }
 
@@ -474,21 +472,21 @@ function _importexportui_get_format_list
 /**
  * Processes the custom-defined field mappings, as entered by the user.
  */
-function _importexportui_set_mappings($form_values) {
+function _importexportui_set_mappings($form_state) {
   $def = importexportapi_get_def();
 
-  $entity_list = $form_values['entity_list'];
-  $type = $form_values['ie_type'];
-  $engine = $form_values['engine'];
+  $entity_list = $form_state['values']['entity_list'];
+  $type = $form_state['values']['ie_type'];
+  $engine = $form_state['values']['engine'];
 
   foreach ($entity_list as $entity_id) {
     $values = array();
 
-    if (!empty($form_values[$entity_id .'_plural'])) {
-      $values["#$type"]['#'. $engine .'_plural'] = $form_values[$entity_id .'_plural'];
+    if (!empty($form_state['values'][$entity_id .'_plural'])) {
+      $values["#$type"]['#'. $engine .'_plural'] = $form_state['values'][$entity_id .'_plural'];
     }
-    if (!empty($form_values[$entity_id .'_mapping'])) {
-      $values["#$type"]['#'. $engine .'_mapping'] = $form_values[$entity_id .'_mapping'];
+    if (!empty($form_state['values'][$entity_id .'_mapping'])) {
+      $values["#$type"]['#'. $engine .'_mapping'] = $form_state['values'][$entity_id .'_mapping'];
     }
 
     if (!empty($values)) {
@@ -496,7 +494,7 @@ function _importexportui_set_mappings($f
     }
 
     $field_ids = element_children($def[$entity_id]);
-    $child_fields = isset($form_values[$entity_id .'_fields']) ? $form_values[$entity_id .'_fields'] : NULL;
+    $child_fields = isset($form_state['values'][$entity_id .'_fields']) ? $form_state['values'][$entity_id .'_fields'] : NULL;
 
     if (!empty($field_ids) && !empty($child_fields)) {
       _importexportui_set_mappings_recurse($def[$entity_id], $field_ids, $child_fields, $type, $engine);
@@ -507,15 +505,15 @@ function _importexportui_set_mappings($f
 /**
  * Recursively processes custom-defined field mappings.
  */
-function _importexportui_set_mappings_recurse($entity, $field_ids, $form_values, $type, $engine) {
+function _importexportui_set_mappings_recurse($entity, $field_ids, $form_state, $type, $engine) {
   foreach ($field_ids as $field_id) {
     $values = array();
 
-    if (!empty($form_values[$field_id .'_plural'])) {
-      $values["#$type"]['#'. $engine .'_plural'] = $form_values[$field_id .'_plural'];
+    if (!empty($form_state['values'][$field_id .'_plural'])) {
+      $values["#$type"]['#'. $engine .'_plural'] = $form_state['values'][$field_id .'_plural'];
     }
-    if (!empty($form_values[$field_id .'_mapping'])) {
-      $values["#$type"]['#'. $engine .'_mapping'] = $form_values[$field_id .'_mapping'];
+    if (!empty($form_state['values'][$field_id .'_mapping'])) {
+      $values["#$type"]['#'. $engine .'_mapping'] = $form_state['values'][$field_id .'_mapping'];
     }
 
     if (!empty($values)) {
@@ -524,7 +522,7 @@ function _importexportui_set_mappings_re
     }
 
     $child_ids = element_children($entity[$field_id]);
-    $child_fields = isset($form_values[$field_id .'_fields']) ? $form_values[$field_id .'_fields'] : NULL;
+    $child_fields = isset($form_state['values'][$field_id .'_fields']) ? $form_state['values'][$field_id .'_fields'] : NULL;
 
     if (!empty($child_ids) && !empty($child_fields)) {
       _importexportui_set_mappings_recurse($entity[$field_id], $child_ids, $child_fields, $type, $engine);
