diff --git theme/views_views_xml_style.theme.inc theme/views_views_xml_style.theme.inc
index e6e874b..0aefeed 100644
--- theme/views_views_xml_style.theme.inc
+++ theme/views_views_xml_style.theme.inc
@@ -26,11 +26,13 @@ function template_preprocess_views_views_xml_style_raw($vars) {
   $plaintext_output = $options["plaintext_output"];
   $content_type = ($options['content_type'] == 'default') ? 'text/xml' : $options['content_type'];
   $header = $options['header'];
-  $xml =  "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
+  if (empty($options['is_xml_fragment'])) $xml =  "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
   if ($header) $xml.= $header."\n"; 
-	$xml .= "<$root>\n";
+	if (!empty($root)) $xml .= "<$root>\n";
   foreach($rows as $row) {
-		$xml .= ($options['element_output'] == 'nested') ? "  <$top_child_object>\n": "  <$top_child_object\n";
+    if (!empty($top_child_object)) {
+		  $xml .= ($options['element_output'] == 'nested') ? "  <$top_child_object>\n": "  <$top_child_object\n";
+		}
 	  foreach($row as $id => $object) {
 		  if ($options['field_output'] == 'normal')  {
 		    if ($object->label) 
@@ -82,9 +84,11 @@ function template_preprocess_views_views_xml_style_raw($vars) {
 		  }
 	  }
 
-	  $xml .= ($options['element_output'] == 'nested') ? "  </$end_top_child_object>\n": "/>\n";
+    if (!empty($end_top_child_object)) {
+	    $xml .= ($options['element_output'] == 'nested') ? "  </$end_top_child_object>\n": "/>\n";
+	  }
 	}
-	$xml .= "</$endroot>\n";
+	if (!empty($endroot)) $xml .= "</$endroot>\n";
 	$vars["xml"] = $xml;
 }
 
diff --git views_plugin_style_xml.inc views_plugin_style_xml.inc
index 66a5ce6..5c00507 100644
--- views_plugin_style_xml.inc
+++ views_plugin_style_xml.inc
@@ -30,6 +30,7 @@ class views_plugin_style_xml extends views_plugin_style {
     $options['header'] = array('default' => NULL, 'translatable' => FALSE);
     $options['author'] = array('default' => $user->name, 'translatable' => FALSE);
     $options['using_views_api_mode'] = array('default' => FALSE, 'translatable' => FALSE);
+    $options['is_xml_fragment'] = array('default' => FALSE, 'translatable' => FALSE);
     //$options['action_on_missing_field'] = array('default' => 'none', 'translatable' => FALSE);
     return $options;
   }
@@ -52,7 +53,7 @@ class views_plugin_style_xml extends views_plugin_style {
       '#type' => 'textfield',
       '#title' => ('Root element name'),
       '#default_value' => $this->options['root_element'],
-      '#description' => ('The name of the root element in a raw XML document.'),
+      '#description' => ('The name of the root element in a raw XML document, may be empty.'),
       //'#process' => array('views_process_dependency'),
       //'#dependency' => array('edit-style-options-schema' => array('raw')),  
     );
@@ -128,6 +129,12 @@ class views_plugin_style_xml extends views_plugin_style {
       '#default_value'  => $this->options['using_views_api_mode'],
       '#description'    => ('Not using View API mode means the XML gets output directly and the server ceases normal page processing.  Using it means the server does not cease processing after outputting the JSON.  This allows the Views API to be used with the view without having to prematurely terminate page processing.'),
     );
+    $form['is_xml_fragment'] = array(
+      '#type'           => 'checkbox',
+      '#title'          => ('Is XML fragment'),
+      '#default_value'  => $this->options['is_xml_fragment'],
+      '#description'    => ('If on then no doctype will be printed.'),
+    );
     /*
     $form['action_on_missing_field'] = array(
       '#type'           => 'radios',
