Index: xml_format.inc
===================================================================
--- xml_format.inc	(revision 112)
+++ xml_format.inc	(revision 116)
@@ -1,6 +1,6 @@
 <?php
 /* double-commented to avoid conflict with svn
-// $Id: xml_format.inc,v 1.1.4.8 2009/02/05 01:44:00 dman Exp $ 
+// $Id: xml_format.inc,v 1.1.4.8 2009/02/05 01:44:00 dman Exp $
 */
 
 /**
@@ -42,7 +42,7 @@
       }
     }
     foreach ($tree as $term) {
-      
+
       $synonyms = taxonomy_get_synonyms($term->tid);
       $output .= "<term>";
       foreach ($term as $key => $value) {
@@ -122,9 +122,9 @@
 
 /**
  * Initiate the parser on the custom XML schema.
- * 
+ *
  * This uses the XML callback parser with tag callbacks.
- * 
+ *
  * @see taxonomy_xml_element_start
  * @see taxonomy_xml_element_end
  * @see taxonomy_xml_element_data
@@ -155,13 +155,13 @@
   // If an existing vocabulary has been chosen or has the same name as the vocabulary being added,
   // terms should be added to the existing vocabulary. Otherwise a new vocabulary should be created.
   if ($vid == 0) {
-    $name = $_tx_vocabulary['name'];
-    $_tx_vocabulary = (array) _taxonomy_xml_get_vocabulary_placeholder(trim($name));
+    $name = trim($_tx_vocabulary['name']);
+    $_tx_vocabulary = (array) _taxonomy_xml_get_vocabulary_placeholder($name, $_tx_vocabulary);
   }
   else {
     $_tx_vocabulary = (array) (module_invoke('taxonomy', 'vocabulary_load', $vid));
   }
-  
+
   // Get the maximum depth of terms
   $term_depth = array();
   foreach ($_tx_terms as $term) {
