Index: views-view-row-unformatted.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_datasource/views-view-row-unformatted.tpl.php,v
retrieving revision 1.1
diff -u -r1.1 views-view-row-unformatted.tpl.php
--- views-view-row-unformatted.tpl.php	25 May 2008 05:54:02 -0000	1.1
+++ views-view-row-unformatted.tpl.php	13 Apr 2009 18:40:27 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id $
+// $Id: views-view-row-unformatted.tpl.php,v 1.1.2.1 2008/07/08 19:43:38 allisterbeharry Exp $
 /**
  * @file views-view-row-unformatted.tpl.php
  * Simple view template to view unformatted fields from the views query.
@@ -25,9 +25,12 @@
 //foreach ($fields as $id => $field)  
 // print $id.":".$field->content."\n";
 
-$field_separator = filter_xss_admin($options['separator']);
-foreach($row as $field_label => $field_value) 
-  $row_unformatted.=  $field_label.":".(!is_null($field_value) ? $field_value: "").$field_separator;
+$field_separator = filter_xss($options['separator']);
+foreach($row as $field_label => $field_value) { 
+  $label = str_replace(':', '#colon#', $field_label);
+  $value = filter_xss(str_replace(':', '#colon#', $field_value));
+  $row_unformatted.=  $label.":".(!is_null($value) ? $value : "").$field_separator;
+}
 print rtrim($row_unformatted, $field_separator).PHP_EOL;
 
   
\ No newline at end of file
Index: views-view-json.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_datasource/views-view-json.tpl.php,v
retrieving revision 1.2
diff -u -r1.2 views-view-json.tpl.php
--- views-view-json.tpl.php	25 May 2008 09:04:45 -0000	1.2
+++ views-view-json.tpl.php	13 Apr 2009 18:40:27 -0000
@@ -1,8 +1,8 @@
 <?php
-// $Id $
+// $Id: views-view-json.tpl.php,v 1.1.2.3 2008/07/09 06:47:58 allisterbeharry Exp $
 /**
  * @file views-view-json.tpl.php
- * View template to render view fields as JSON. Currently only supports the Exhibit format.
+ * View template to render view fields as JSON. Supports simple JSON and the Exhibit format.
  *
  * - $view: The view in use.
  * - $rows: The raw result objects from the query, with all data it fetched.
@@ -12,53 +12,108 @@
  * @see views_json.views.inc
  */
  
-//print_r($view);
-//print_r($rows);
-//print_r($options);
+if (get_class($view->style_plugin->row_plugin) !== 'unformatted_plugin_row') {
+  print ('<b style="color:red">The row plugin is not of type Unformatted.</b>');
+  return;
+}
+else if (($view->style_plugin->row_plugin->options['separator']) !== '|') {
+  print ('<b style="color:red">The row plugin separator is not "<span style="color:blue">|</span>" (you can set this in the options for the row style plugin.)</b>');
+  return;
+}
 
 $items = array();
 foreach($rows as $row) {
-//  print_r($row).EOL;
   $items[] = explode("|", trim($row));
-  
-} 
-//print_r($items);
-//foreach ($items as $item) { 
-//  print_r($item).PHP_EOL;
-//	foreach($item as $itemfield) {
-//		print($itemfield);
-//		$itemfieldarray = explode(":", $itemfield);
-//		print_r($itemfieldarray).PHP_EOL;
-//		$label = $itemfieldarray[0]; $value=$itemfieldarray[1];
-//		print $label." : ".$value;
-//	}
-//}
+  }
+
+if ($options['format'] == 'Simple') json_simple_render($items, $view);
+if ($options['format'] == 'Exhibit') json_exhibit_render($items, $view);
 
-if ($options['format'] == 'Exhibit') json_exhibit_render($items);
+function json_simple_render($items, $view) {
+  define('EXHIBIT_DATE_FORMAT', '%Y-%m-%d %H:%M:%S');	
+	$json = '"nodes":'.str_repeat(" ", 4)."[\n";
+	foreach($items as $item) {
+		$json.= str_repeat(" ", 6)."{\n";
+		foreach($item as $itemfield) {
+			$itemfieldarray = explode(":", $itemfield);
+
+			/*replace escaped colons with actual colon*/
+			$itemfieldarray[0] = str_replace('#colon#', ':', $itemfieldarray[0]);
+			$itemfieldarray[1] = str_replace('#colon#', ':', $itemfieldarray[1]);
+
+			$label = trim(views_json_strip_illegal_chars(views_json_encode_special_chars($itemfieldarray[0])));
+      $value = views_json_encode_special_chars(trim(views_json_is_date($itemfieldarray[1])));
+      if (strtotime($value))
+        $value = gmstrftime(EXHIBIT_DATE_FORMAT, strtotime($value));
+      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
+      $json.=str_repeat(" ", 8).'"'.$label.'"'. " ".": ".'"'.$value.'"'.",\n";
+		}
+		$json.=str_repeat(" ", 6)."},\n\n";	
+	}
+	$json.=str_repeat(" ", 4)."]";
+  /*
+   * The following will cause an error in a live view preview - comment out if
+   * debugging in there.
+   */
+  if ($view->override_path) { //inside a live preview so just output the text (not working yet)
+    print $json; 
+  }
+  else { //real deal so switch the content type and stop further processing of the page
+    drupal_set_header('Content-Type: text/javascript');
+    print $json;
+    module_invoke_all('exit');
+    exit;
+ }
+	
+}
 
-function json_exhibit_render($items) {
+function json_exhibit_render($items, $view) {
   define('EXHIBIT_DATE_FORMAT', '%Y-%m-%d %H:%M:%S');
-  $json = "{\n".str_repeat(" ", 4).'"items"'." : ". "  [";
-  foreach ($items as $item) {
-  	$json.="\n".str_repeat(" ", 8)."{\n"; 
+  $json = "{\n".str_repeat(" ", 4).'"items"'." : ". "[\n";
+  foreach ($items as $item) { 
+  	$json.=str_repeat(" ", 8)."{\n";
+  	$json.=str_repeat(" ", 12).'"type" '. " ".": ".'"'.'##type##'.'",'."\n";
+    $json.=str_repeat(" ", 12).'"label" '. " "." : ".'"'.'##label##'.'",'."\n"; 
   	foreach ($item as $itemfield) {
   		$itemfieldarray = explode(":", $itemfield);
-  		$label = $itemfieldarray[0]; $value=$itemfieldarray[1];        
-      $value = preg_replace('/<.*?>/', '', $value); // strip html tags
-      $value = str_replace(array("\r", "\n", ','), ' ', $value); // strip line breaks and commas
-      $value = str_replace('"', '""', $value); // escape " characters
-      $value = decode_entities($value);
-      $json.=str_repeat(" ", 8).$label. " ".": ".'"'.$value.'"'."\n";
+  		
+      /*replace escaped colons with actual colon*/
+      $itemfieldarray[0] = str_replace('#colon#', ':', $itemfieldarray[0]);
+      $itemfieldarray[1] = str_replace('#colon#', ':', $itemfieldarray[1]);
+  		
+  		$label = trim(views_json_strip_illegal_chars(views_json_encode_special_chars($itemfieldarray[0]))); 
+  		$value=views_json_encode_special_chars(trim(views_json_is_date($itemfieldarray[1])));
+  		//if (empty($value)) continue;        
+      if (strtotime($value))
+        $value = gmstrftime(EXHIBIT_DATE_FORMAT, strtotime($value));
+      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
+      if ($label == 'type') $json = str_replace('##type##', $value, $json);
+      elseif ($label == 'label') $json = str_replace('##label##', $value, $json);
+      else $json.=str_repeat(" ", 12).'"'.$label.'"'. " ".": ".'"'.$value.'"'.",\n";
   	}
-  	$json.=str_repeat(" ", 8)."},\n";
+   if (strpos($json, '##type##') !== false) 
+    $json = str_replace('##type##', 'Item', $json);
+   if (strpos($json, '##label##') !== false) 
+    $json = str_replace('##label##',  'none', $json);    	
+   $json = rtrim($json, ",\n");
+   $json.="\n";
+   $json.=str_repeat(" ", 8)."},\n";
   }
+  $json = rtrim($json, ",\n");
+  $json.="\n";
   $json.=str_repeat(" ", 4)."]\n}";
   /*
    * The following will cause an error in a live view preview - comment out if
    * debugging in there.
    */
-  drupal_set_header('Content-Type: text/javascript');
-  print $json;
-  module_invoke_all('exit');
-  exit;
+  if ($view->override_path) { //inside a live preview so just output the text
+  	print $json; 
+  }
+  else { //real deal so switch the content type and stop further processing of the page
+    drupal_set_header('Content-Type: text/javascript');
+    print $json;
+    module_invoke_all('exit');
+    exit;
+ }
+
 }
Index: views_json.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_datasource/views_json.info,v
retrieving revision 1.1
diff -u -r1.1 views_json.info
--- views_json.info	25 May 2008 05:54:02 -0000	1.1
+++ views_json.info	13 Apr 2009 18:40:27 -0000
@@ -1,6 +1,6 @@
-; $Id $
 name = Views JSON
-description = "Views style plugin to render node content as JSON"
-package = Views
+description = "Views style plugin to render node content as JSON."
+package = Views Datasource
+dependencies[] = views_datasource
 core = 6.x
-dependencies[] = views
\ No newline at end of file
+
Index: views_json.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_datasource/views_json.views.inc,v
retrieving revision 1.1
diff -u -r1.1 views_json.views.inc
--- views_json.views.inc	25 May 2008 05:54:02 -0000	1.1
+++ views_json.views.inc	13 Apr 2009 18:40:27 -0000
@@ -1,5 +1,5 @@
 <?php
-//$Id $
+//$Id: views_json.views.inc,v 1.1.2.1 2008/07/08 19:43:38 allisterbeharry Exp $
 /**
  * @file views_json.views.inc 
  * Views style plugin to render nodes in the JSON data format.
@@ -18,59 +18,17 @@
         'title' => t('JSON data document'),
         'theme' => 'views_view_json',
         'help' => t('Displays nodes in the JSON data format.'),
-        'handler' => 'views_plugin_style_json',
+        'handler' => 'json_plugin_style',
         'uses row plugin' => TRUE,
         'uses fields' => TRUE,
         'uses options' => TRUE,
         'type' => 'normal',       
       ),
-    ),
-    'row' => array( //declare the unformatted row plugin
-      'unformatted' => array(
-        'title' => t('Unformatted'),
-        'help' => t('(Displays the unformatted data for each row from the views query with each row on a new line. Set as | for views_json.'),
-        'handler' => 'views_plugin_row_unformatted',
-        'theme' => 'views_view_row_unformatted',
-        'uses fields' => TRUE,
-        'uses options' => TRUE,
-        'type' => 'normal',
-      )
-     )  
+    ) 
   );
 }
 
 /**
- * Implementation of views_plugin_style
- *
- */
-
-class views_plugin_style_json extends views_plugin_style {
-  
-  /**
-   * Set default options
-   */
-  function options(&$options) {
-    $options['format'] = 'Exhibit';
-  }
-  
-  /**
-   * Provide a form for setting options.
-   *
-   * @param array $form
-   * @param array $form_state
-   */  
-  function options_form(&$form, &$form_state) {
-    $form['format'] = array(
-      '#type' => 'radios',
-      '#title' => t('JSON data format'),
-      '#options' => array('Exhibit' => t('MIT Simile/Exhibit'), 'Canonical' => t('Canonical'), 'JSONP' => t('JSONP')),
-      '#default_value' => $this->options['format'],
-    );
-  }
-
-}
-
-/**
  * Theme preprocess function for views-view-json.tpl.php
  *
  * @param array $vars
@@ -80,73 +38,3 @@
   $options  = $view->style_handler->options;
   $handler  = $view->style_handler;
 }
-
-
-/**
- * Implementation of views_row_plugin
- *
- */
-class views_plugin_row_unformatted extends views_plugin_row {
-	
-	/**
-	 * Set default options
-	 *
-	 * @param array $options
-	 */
-  function options(&$options) {
-    $options['separator'] = '|';
-  }
-
-  /**
-   * Provide a form for setting options.
-   */
-  function options_form(&$form, &$form_state) {
-    $fields = $this->display->handler->get_option('fields');
-    $options = array();
-    foreach ($fields as $field => $info) {
-      $handler = views_get_handler($info['table'], $info['field'], 'field');
-      if ($handler) {
-        $options[$field] = $handler->ui_name();
-      }
-    }
-  
-    $form['separator'] = array(
-      '#title' => t('Separator'),
-      '#type' => 'textfield',
-      '#size' => 10,
-      '#default_value' => isset($this->options['separator']) ? $this->options['separator'] : ',',
-      '#description' => t('The separator is placed between fields.'),
-    );
-  }
-  
-}
-
-/**
- * Theme preprocess function for views-view-row-unformatted.tpl.php
- */
-function template_preprocess_views_view_row_unformatted(&$vars) {
-  $view = $vars['view'];
-  //print('preprocess');
-  // Loop through the fields for this view.
-  foreach ($view->field as $id => $field) {
-    if (!empty($field['handler']) && is_object($field['handler'])) {
-      $object = new stdClass();
-      $object->content = $field['handler']->theme($vars['row']);
-      if (isset($field['handler']->field_alias) && isset($vars['row']->{$field['handler']->field_alias})) {
-        $object->raw = $vars['row']->{$field['handler']->field_alias};
-      }
-      else {
-        $object->raw = NULL; // make sure it exists to reduce NOTICE
-      }
-      if (!empty($vars['options']['separator']) && $object->content) {
-        $object->separator = filter_xss_admin($vars['options']['separator']);
-      }
-
-      $object->handler = $field['handler'];
-      $object->class = views_css_safe($id);
-      $object->label = check_plain($field['handler']->label());
-      $vars['fields'][$id] = $object;
-    }
-  }
-  
-} 
Index: views_json.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_datasource/views_json.module,v
retrieving revision 1.1
diff -u -r1.1 views_json.module
--- views_json.module	25 May 2008 05:54:02 -0000	1.1
+++ views_json.module	13 Apr 2009 18:40:27 -0000
@@ -1,13 +1,69 @@
 <?php
-//$Id $
+//$Id: views_json.module,v 1.1.2.1 2008/07/08 19:43:38 allisterbeharry Exp $
 /**
  @file views_json.module
- Placekeeper file for views_datasource module file
+ Module definition for views_json 
  @see views_json.views.inc
 */
-//$views_path = drupal_get_path('module', 'views');
-//require_once "./$views_path//views.module";
-//views_include_handlers();
-//$views_json_path = drupal_get_path('module', 'views_json');
-//require_once (".//$views_json_path//views_json.views.inc");
 
+/**
+ * Implementation of hook_views_api().
+ *
+ * This one is used as the base to reduce errors when updating.
+ */
+function views_json_views_api() {
+  return array(
+    'api' => 2,
+  );
+}
+
+/**
+ * Strips illegal JSON characters in identifier string
+ *
+ * @param string $input
+ * @return string
+ */
+
+function views_json_strip_illegal_chars($input) {
+ $output = str_replace(array('{','}','[', ']', ':', ',', '"', "'", chr(47), chr(92)), '', $input);
+ $output = preg_replace(
+                        '/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP
+                        '\x{01}-\x{1F}'. //Non-printable ASCII characters
+                        '\x{0}]/u', // NULL byte
+        '', $output);
+
+ return $output;  
+}
+
+/**
+ * Encodes special JSON characters in string
+ *
+ * @param string $input
+ * @return string
+ */
+function views_json_encode_special_chars($input) {
+  $output = str_replace(chr(92), '\\', $input);
+  $output = str_replace(chr(47), '\/', $output);
+  $output = str_replace('"', '\"', $output);
+  $output = str_replace(chr(8), '\b', $output);
+  $output = str_replace(chr(12), '\f', $output);
+  $output = str_replace(chr(13).chr(10), '\n', $output);
+  $output = str_replace(chr(10), '\n', $output);
+  $output = str_replace(chr(13), '\r', $output);
+  $output = str_replace(chr(9), '\t', $output);
+  return $output;
+}
+
+/**
+ * If input is a serialized date array, return a date string 
+ *
+ * @param unknown_type $input
+ * @return unknown
+ */
+function views_json_is_date ($input) {
+  if (strpos($input, 'a:3:{s:5:"month"') !== 0) return $input; 
+  else { //serialized date array
+    $date = unserialize($input);
+    return date(DATE_ISO8601, mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
+  }
+}
\ No newline at end of file
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_datasource/README.txt,v
retrieving revision 1.1
diff -u -r1.1 README.txt
--- README.txt	25 May 2008 05:54:02 -0000	1.1
+++ README.txt	13 Apr 2009 18:40:27 -0000
@@ -1,21 +1,43 @@
-$Id: README.txt,v 1.1 2008/05/25 05:54:02 allisterbeharry Exp $
+$Id: README.txt,v 1.1.2.3 2008/07/09 06:47:58 allisterbeharry Exp $
 
 Views Datasource README
 ---------------------------------------
 
 Current Version
 ---------------
-6.x-0.1-dev
+6.x-1.0-ALPHA2
 
 Release Notes
 -------------
-CVS module created and intial code uploaded to repository. This is a 
-proof-of-concept release with a working views_json plugin for Drupal 6. In the
-Views interface simply select the view style as JSON data document (Exhibit 
-format only) and the row style as Unformatted (separator must be |). Because the
-template changes the page Content-type to text/javascript and immediately exits 
-Drupal, the live preview will throw an error. This can be ignored; just save 
-your view as a page and view it normally at the URL to get the JSON output.
+Exhibit JSON output now validates with the validator at 
+http://simile.mit.edu/babel/validator Added simple JSON support to views_json
+Added views_xml plugin with raw XML and OPML renderer. Added views_rdf plugin
+with FOAF renderer. Added views_xhtml plugin with hCard renderer.
+
+views_json and views_xml will take the nodes generated by a view and output 
+them as, in the case of views_json, an array of Javascript objects with each 
+object's properties corresponding to a view field, and in the case of views_xml,
+an XML document with the root element called 'nodes' and a 'node' element with
+each node's sub-elements corresponding to a view field. views_rdf will render 
+the nodes generated by a view as an RDF/XML FOAF document with each
+<foaf:Person> element corresponding to a node in the view. To use just have
+fields in the view named as their equivalent FOAF properties - for example to
+have a <foaf:name> or <foaf:nick> element, have a field named 'name' and 'nick'
+in your view. Similarly views_xhtml provides the hCard plugin which will render
+each node in the XHTML hCard format - just have fields corresponding to hCard
+properties defined in the view. For example to create an <email> element inside 
+the <div class="hcard"> root element, just have one or more fields in the view
+containing the text 'email'.
+
+The FOAF and vCard renderers are most useful with view based on user profiles 
+where you can create profile fields corresponding to properties defined in the 
+FOAF (http://xmlns.com/foaf/spec/) or hCard 
+(http://microformats.org/wiki/hcard-cheatsheet) spec. However any node type 
+(like those created with nodeprofile or Bio or Advanced Profile or Content
+Profile) can be used in the view. It doesn't matter what data table the view
+is base on, only what fields are exposed. See http://soc2008.hotdrupal.com for
+ways to use the plugins, and http://groups.drupal.org/node/11387 for more
+docs.
 
 About
 -----
@@ -33,4 +55,15 @@
   1)views_xml - Output as raw XML, OPML, and Atom;
   2)views_json - Output as Simile/Exhibit JSON, canonical JSON, JSONP;
   3)views_rdf - Output as FOAF, SIOC and DOAP;
-  4)views_xhtml - Output as hCard, hCalendar, and Geo. 
\ No newline at end of file
+  4)views_xhtml - Output as hCard, hCalendar, and Geo.
+  
+To use these plugins you should:
+1) Enable all four modules;
+2) Set the row style plugin for your view to Unformatted;
+3) In the Unformatted row style plugin options set the separator to "|" (it is 
+   set to this by default.)
+4) Set the view style plugin to one of:
+   i)  JSON data document
+   ii) XML data document
+   iii) RDF data document
+   iv) XHTML data document
\ No newline at end of file
Index: json_plugin_style.inc
===================================================================
RCS file: json_plugin_style.inc
diff -N json_plugin_style.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ json_plugin_style.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * Implementation of views_plugin_style
+ *
+ */
+
+class json_plugin_style extends views_plugin_style {
+  
+  /**
+   * Set default options
+   */
+  function options(&$options) {
+    $options['format'] = 'Simple';
+  }
+  
+  /**
+   * Provide a form for setting options.
+   *
+   * @param array $form
+   * @param array $form_state
+   */  
+  function options_form(&$form, &$form_state) {
+    $form['format'] = array(
+      '#type' => 'radios',
+      '#title' => t('JSON data format'),
+      '#options' => array('Simple' => t('Simple'), 'Exhibit' => t('MIT Simile/Exhibit')),
+      '#default_value' => $this->options['format'],
+    );
+  }
+
+}
Index: views-view-xml.tpl.php
===================================================================
RCS file: views-view-xml.tpl.php
diff -N views-view-xml.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views-view-xml.tpl.php	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,110 @@
+<?php
+// $Id: views-view-xml.tpl.php,v 1.1.2.3 2008/07/09 06:47:58 allisterbeharry Exp $
+/**
+ * @file views-view-xml.tpl.php
+ * View template to render view fields as XML. Supports raw XML and OPML schema.
+ *
+ * - $view: The view in use.
+ * - $rows: The raw result objects from the query, with all data it fetched.
+ * - $options: The options for the style passed in from the UI.
+ *
+ * @ingroup views_templates
+ * @see views_xml.views.inc
+ */
+
+if (get_class($view->style_plugin->row_plugin) !== 'unformatted_plugin_row') {
+  print ('<b style="color:red">The row plugin is not of type Unformatted.</b>');
+  return;
+}
+else if (($view->style_plugin->row_plugin->options['separator']) !== '|') {
+  print ('<b style="color:red">The row plugin separator is not "<span style="color:blue">|</span>" (you can set this in the options for the row style plugin.)</b>');
+  return;
+}
+
+$nodes = array();
+foreach($rows as $row) {
+  $nodes[] = explode("|", trim($row));
+  
+}
+
+if ($options['schema'] == 'raw') xml_raw_render($nodes, $view);
+if ($options['schema'] == 'opml') xml_opml_render($nodes, $view);
+
+function xml_raw_render($nodes, $view) {
+	$xml .= '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
+  $xml .= '<!-- generator="Drupal Views_Datasource.Module" -->'."\n";
+  $xml .='<nodes>'."\n";  
+
+  foreach ($nodes as $node) {
+    $xml .= '  <node>'."\n";   
+    foreach($node as $nodefield) {
+      $nodefieldarray = explode(":", $nodefield);
+
+      /*replace escaped colons with actual colon*/
+      $nodefieldarray[0] = str_replace('#colon#', ':', $nodefieldarray[0]);
+      $nodefieldarray[1] = str_replace('#colon#', ':', $nodefieldarray[1]);
+
+      $label = views_xml_strip_illegal_chars($nodefieldarray[0]);
+      $value = views_xml_strip_illegal_chars(views_xml_is_date($nodefieldarray[1]));
+      if (strtotime($value))
+        $value = date(DATE_ISO8601, strtotime($value));
+      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
+      if (is_null($value) || ($value === '')) continue;
+      $xml .= "    <$label>$value</$label>\n";
+    }
+  $xml .= '  </node>'."\n";
+  }
+  $xml .='</nodes>'."\n";
+  if ($view->override_path) //inside live preview 
+    print htmlspecialchars($xml);
+  else {  
+   drupal_set_header('Content-Type: text/xml');
+   print $xml;
+   module_invoke_all('exit');
+   exit;
+  }
+}
+
+function xml_opml_render($nodes, $view) {
+	//var_dump($view);
+	//return;
+  global $user;
+	$xml .= '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
+  $xml .= '<!-- generator="Drupal Views_Datasource.Module" -->'."\n";
+  $xml .='<opml version="1.0">'."\n";  
+	$xml .='<head>'."\n";
+	$xml .='  <title>'.variable_get('site_name', 'drupal').'-'.$view->name.'</title>'."\n";
+	$xml .='  <ownerName>'.$user->name.'</ownerName>'."\n";
+	$xml .='  <ownerEmail>'.$user->mail.'</ownerEmail>'."\n";
+	$xml .='  <dateCreated>'.date(DATE_ISO8601, time()).'</dateCreated>'."\n";
+	$xml .='</head>'."\n";
+	$xml .='<body>'."\n";
+  foreach ($nodes as $node) {
+    $xml .= '  <outline ';
+    $fieldcount = 0;   
+    foreach($node as $nodefield) {
+    	$fieldcount++;
+      $nodefieldarray = explode(":", $nodefield);
+      /*replace escaped colons with actual colon*/
+      $nodefieldarray[0] = str_replace('#colon#', ':', $nodefieldarray[0]);
+      $nodefieldarray[1] = str_replace('#colon#', ':', $nodefieldarray[1]);
+
+      $label = views_xml_strip_illegal_chars($nodefieldarray[0]);
+      $value = views_xml_strip_illegal_chars(views_xml_is_date($nodefieldarray[1]));
+      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
+      if (is_null($value) || ($value === '')) continue;
+      $xml .= $label. '="'.$value.'" ';
+    }
+  $xml .= '/>'."\n";
+  }
+	$xml .='</body>'."\n";
+  $xml .='</opml>'."\n";
+	if ($view->override_path) //inside live preview 
+	  print htmlspecialchars($xml);
+	else {  
+   drupal_set_header('Content-Type: text/xml');
+   print $xml;
+   module_invoke_all('exit');
+   exit;
+	}
+}
Index: views-view-xhtml.tpl.php
===================================================================
RCS file: views-view-xhtml.tpl.php
diff -N views-view-xhtml.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views-view-xhtml.tpl.php	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,258 @@
+<?php
+// $Id: views-view-xhtml.tpl.php,v 1.1.2.3 2008/07/09 06:47:58 allisterbeharry Exp $
+/**
+ * @file views-view-xhtml.tpl.php
+ * View template to render views as XHTML microformats. Supports hCard format 
+ *
+ * - $view: The view in use.
+ * - $rows: The raw result objects from the query, with all data it fetched.
+ * - $options: The options for the style passed in from the UI.
+ *
+ * @ingroup views_templates
+ * @see views_xhtml.views.inc
+ */
+
+if (get_class($view->style_plugin->row_plugin) !== 'unformatted_plugin_row') {
+	print ('<b style="color:red">The row plugin is not of type Unformatted.</b>');
+	return;
+}
+else if (($view->style_plugin->row_plugin->options['separator']) !== '|') {
+	print ('<b style="color:red">The row plugin separator is not "<span style="color:blue">|</span>" (you can set this in the options for the row style plugin.)</b>');
+	return;
+}
+
+$nodes = array();
+foreach($rows as $row) {
+  $nodes[] = explode("|", trim($row));
+  
+}
+if (count($nodes) != count($rows)) {
+  print ("Did not get all rows (is the field separator '|' ?)");
+  return;
+}
+  
+if ($options['format'] == 'hcard') xhtml_hcard_render($nodes, $view);
+
+function xhtml_hcard_render($nodes, $view) {
+  $xhtml .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n";
+  $xhtml .= '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"'.">\r\n";
+  $xhtml .= '<head>'."\r\n";
+  $xhtml .= '  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'."\r\n";
+  $xhtml .= '  <meta name="KEYWORDS" content="hCards" />'."\r\n";
+  $xhtml .= '  <title>hCards</title>'."\r\n";
+  $xhtml .= '</head>'."\r\n";
+  $xhtml .= '<body>'."\r\n";
+  foreach ($nodes as $node) {
+    $hcard = array('adr'=> array(
+                           'type' => '', 
+                           'post-office-box' => '',
+                           'street-address' => array(),
+                           'extended-address' => '',
+                           'region' => '',
+                           'locality' => '',
+                           'postal-code' => '',
+                           'country-name' => ''    
+                           ),
+                   'agent' => array(),
+                   'bday' => '',
+                   'class' => '',
+                   'category' => array(),
+                   'email' => array(),
+                   'fn' => '',
+                   'n' => array(
+                          'honorific-prefix' => '',
+                          'given-name' => '',
+                          'additional-name' => '',
+                          'family-name' => '',
+                          'honorific-suffix' => ''    
+                           ),
+                   'nickname' => '',                
+                   'org' => array (
+                           'organization-name' => '',
+                           'organization-unit' => array()
+                           ),                        
+                   'photo' => '',
+                   'tel'=> array()         
+                  );
+    foreach($node as $nodefield) {
+      $nodefieldarray = explode(":", $nodefield);
+
+      /*replace escaped colons with actual colon*/
+      $nodefieldarray[0] = str_replace('#colon#', ':', $nodefieldarray[0]);
+      $nodefieldarray[1] = str_replace('#colon#', ':', $nodefieldarray[1]);
+
+      $label = views_xhtml_strip_illegal_chars($nodefieldarray[0]);
+      $value = views_xhtml_strip_illegal_chars(views_xhtml_is_date($nodefieldarray[1]));
+      if (strtotime($value))
+        $value = date(DATE_ISO8601, strtotime($value));
+      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
+      if (is_null($value) || ($value === '')) continue;
+      
+      if (stripos($label, 'address-type') !== FALSE) {
+        $hcard['adr']['type'] = $value; 
+      }
+      if (stripos($label, 'post-office-box') !== FALSE) { 
+        $hcard['adr']['post-office-box'] = $value;  
+      }
+      if (stripos($label, 'street-address') !== FALSE) {
+        $hcard['adr']['street-address'][] = $value;  
+      }
+      if (stripos($label, 'extended-address') !== FALSE) {
+        $hcard['adr']['extended-address'] = $value;  
+      }
+      if (stripos($label, 'region') !== FALSE) {
+        $hcard['adr']['region'] = $value;  
+      }
+      if (stripos($label, 'locality') !== FALSE) {
+        $hcard['adr']['locality'] = $value;  
+      }
+      if (stripos($label, 'postal-code') !== FALSE) {
+        $hcard['adr']['postal-code'] = $value;  
+      }
+      if (stripos($label, 'country-name') !== FALSE) {
+        $hcard['adr']['country-name'] = $value;  
+      }
+      if (stripos($label, 'agent') !== FALSE) {
+        $hcard['agent'][] = $value;  
+      }
+      if (stripos($label, 'bday') !== FALSE) {
+        $hcard['bday'] = $value;  
+      }
+      if (stripos($label, 'class') !== FALSE) {
+        $hcard['class'] = $value;  
+      }
+      if (stripos($label, 'category') !== FALSE) {
+        $hcard['category'][] = $value;  
+      }
+      if (stripos($label, 'email') !== FALSE) {
+        $hcard['email'][$label] = $value;  
+      }
+      if (stripos($label, 'honorific-prefix') !== FALSE) {
+        $hcard['n']['honorific-prefix'] = $value;  
+      }
+      if (stripos($label, 'given-name') !== FALSE) {
+        $hcard['n']['given-name'] = $value;  
+      }
+      if (stripos($label, 'additional-name') !== FALSE) {
+        $hcard['n']['additional-name'] = $value;  
+      }
+      if (stripos($label, 'family-name') !== FALSE) {
+        $hcard['n']['family-name'] = $value;  
+      }
+      if (stripos($label, 'honorific-suffix') !== FALSE) {
+        $hcard['n']['honorific-suffix'] = $value;  
+      }        
+      if (stripos($label, 'fn') !== FALSE) {
+        $hcard['fn'] = $value;  
+      }
+      if (stripos($label, 'nickname') !== FALSE) {
+        $hcard['nickname'] = $value;  
+      }
+      if (stripos($label, 'organization-name') !== FALSE) {
+        $hcard['org']['organization-name'] = $value;  
+      }
+      if (stripos($label, 'organization-unit') !== FALSE) {
+        $hcard['org']['organization-unit'][] = $value;  
+      }
+      if (stripos($label, 'photo') !== FALSE) {
+        $hcard['photo'] = $value;  
+      }
+      if (stripos($label, 'tel') === 0) {
+        $hcard['tel'][$label] = $value;  
+      }                                
+    } 
+    $xhtml .= '<div class = "vcard">'."\r\n";
+    if ($hcard['photo'] != '')
+      $xhtml .='  <img class="photo" alt="photo" title="photo" style="height:96px;width:96px" src="'.$hcard['photo'].'"/>'."<br/>\r\n";      
+    if ($hcard['fn'])
+      $xhtml .='  <span class="fn">'.$hcard['fn'].'</span>'."<br/>\r\n";
+    if ($hcard['nickname'])
+      $xhtml .='  <span class="nickname">'.$hcard['nickname'].'</span>'."<br/>\r\n";
+    $name = $hcard['n'];
+    if ($hcard['fn']) 
+      $xhtml .= '  <span class = "n">'."\r\n";
+    else
+      $xhtml .= '  <span class = "fn n">'."\r\n";
+    if ($name['honorific-prefix'] !== '')
+      $xhtml .='    <span class="honorific-prefix">'.$name['honorific-prefix'].'</span>'."\r\n";
+    if ($name['given-name'] !== '')
+      $xhtml .='    <span class="given-name">'.$name['given-name'].'</span>'."\r\n";
+    if ($name['additional-name'] !== '')
+      $xhtml .='    <span class="additional-name">'.$name['additional-name'].'</span>'."\r\n";
+    if ($name['family-name'] !== '')
+      $xhtml .='    <span class="family-name">'.$name['family-name'].'</span>'."\r\n";
+    if ($name['honorific-suffix'] !== '')
+      $xhtml .='    <span class="honorific-suffix">'.$name['honorific-suffix'].'</span>'."\r\n";
+    $xhtml .= '  </span><br/>'."\r\n";
+    if ($hcard['nickname'] !== '')
+      $xhtml .= '    <span class="nickname">'.$hcard['nickname'].'</span><br/>'."\r\n";                  
+    $org = $hcard['org'];
+    $xhtml .= '  <span class="org">'."\r\n";
+    if ($org['organization-name'] !== '')
+      $xhtml.= '    <span class="organization name">'.$org['organization-name'].'</span><br/>'."\r\n";
+    $org_units = $org['organization-unit'];  
+    foreach ($org_units as $org_unit) 
+      $xhtml .='    <span class="organization-unit">'.$org_unit.'</span>'."<br/>\r\n";
+    $xhtml .= '  </span>'."\r\n";  
+    $address = $hcard['adr'];
+    $xhtml .= '  <span class = "adr">'."\r\n";
+    if ($address['type'] !== '')
+      $xhtml .='    <span class="type">'.$address['type'].'</span>'."<br/>\r\n";
+    if ($address['post-office-box'] !== '')
+      $xhtml .='    <span class="post-office-box">'.$address['post-office-box'].'</span>'."<br/>\r\n";
+    $street_addresses = $address['street-address'];  
+    foreach ($street_addresses as $street_address) 
+      $xhtml .='    <span class="street-address">'.$street_address.'</span>'."<br/>\r\n";
+    if ($address['extended-address'] !== '')
+      $xhtml .='    <span class="extended-address">'.$address['extended-address'].'</span>'."<br/>\r\n";
+    if ($address['region'] !== '')
+      $xhtml .='    <span class="region">'.$address['region'].'</span>'."<br/>\r\n";
+    if ($address['locality'] !== '')
+      $xhtml .='    <span class="locality">'.$address['locality'].'</span>'."<br/>\r\n";
+    if ($address['postal-code'] !== '')
+      $xhtml .='    <span class="postal-code">'.$address['postal-code'].'</span>'."<br/>\r\n";
+    if ($address['country-name'] !== '')
+      $xhtml .='    <span class="country-name">'.$address['country-name'].'</span>'."\r\n";
+    $xhtml .= '  </span><br/>'."\r\n";       
+    $agents = $hcard['agent'];
+    foreach ($agents as $agent) 
+      $xhtml .='  <span class="agent">'.$agent.'</span>'."<br/>\r\n";
+    $birthday =  $hcard['bday'];
+    if ($birthday !== '') 
+      $xhtml .='  <span class="bday">'.$birthday.'</span>'."<br/>\r\n";      
+    $class = $hcard['class'];
+    if ($class !== '')
+      $xhtml .='  <span class="class">'.$class.'</span>'."<br/>\r\n";
+    $categories = $hcard['category'];  
+    foreach ($categories as $category) 
+      $xhtml .='  <span class="category">'.$category.'</span>'."<br/>\r\n";
+    if ($hcard['email']) {
+      $email_addrs = $hcard['email']; 
+      foreach ($email_addrs as $email_type => $email_addr) 
+        $xhtml .='  <span class="email">'."\r\n".
+                  '    <span class="type">'.$email_type.': </span>'."\r\n".
+                  '    <a class="value" href="mailto:'.$email_addr.'">'.$email_addr.'</a>'."\r\n".
+                  '  </span>'."<br/>\r\n";    
+    
+    }
+    if ($hcard['tel']) {
+      $tel_nos = $hcard['tel'];
+      foreach ($tel_nos as $tel_no_type => $tel_no) 
+        $xhtml .='  <span class="tel">'.
+                    '<span class="type">'.$tel_no_type.': </span>'.
+                    '<span class="value">'.$tel_no.'</span>'.
+                    '</span>'."<br/>\r\n";    
+    }    
+    $xhtml .= '</div>'."\r\n";
+  }
+
+  $xhtml.='</body>'."\r\n";
+  $xhtml.='</html>'."\r\n";
+  if ($view->override_path) //inside live preview 
+    print htmlspecialchars($xhtml);
+  else {  
+   print $xhtml;
+   module_invoke_all('exit');
+   exit;
+  }  
+}
Index: views_xhtml.info
===================================================================
RCS file: views_xhtml.info
diff -N views_xhtml.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_xhtml.info	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,6 @@
+name = Views XHTML
+description = "Views style plugin to render node content as XHTML microformats."
+package = Views Datasource
+dependencies[] = views_datasource
+core = 6.x
+
Index: views_rdf.module
===================================================================
RCS file: views_rdf.module
diff -N views_rdf.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_rdf.module	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,58 @@
+<?php
+//$Id: views_rdf.module,v 1.1.4.3 2008/07/08 19:43:38 allisterbeharry Exp $
+/**
+ @file views_rdf.module
+ Module definition for views_rdf 
+ @see views_rdf.views.inc
+*/
+
+/**
+ * Implementation of hook_views_api().
+ *
+ * This one is used as the base to reduce errors when updating.
+ */
+function views_rdf_views_api() {
+  return array(
+    'api' => 2,
+  );
+}
+
+/**
+ * Strips illegal Unicode characters and encodes entities in string
+ *
+ * @param string $input
+ * @return string
+ */
+function views_rdf_strip_illegal_chars($input) {
+  $output = preg_replace('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP
+        '\x{01}-\x{1F}'. //Non-printable ASCII characters
+        '\x{AD}'. // Soft-hyphen
+        '\x{2000}-\x{200F}'. // Various space characters
+        '\x{2028}-\x{202F}'. // Bidirectional text overrides
+        '\x{205F}-\x{206F}'. // Various text hinting characters
+        '\x{FEFF}'. // Byte order mark
+        '\x{FF01}-\x{FF60}'. // Full-width latin
+        '\x{FFF9}-\x{FFFD}'. // Replacement characters
+        '\x{0}]/u', // NULL byte
+        '', $input);
+  $output = str_replace('"', '&quot;', $output); //encode quote
+  $output = str_replace('&', '&amp;', $output); //encode ampersand
+  $output = str_replace("'", '&pos;', $output); //encode apostrophe
+  $output = str_replace('<', '&lt;', $output); //encode left-angled bracket
+  $output = str_replace('>', '&rt;', $output); //encode right-angled bracket
+  return $output;
+}
+
+/**
+ * If input is a serialized date array, return a date string 
+ *
+ * @param unknown_type $input
+ * @return unknown
+ */
+function views_rdf_is_date ($input) {
+  if (strpos($input, 'a:3:{s:5:"month"') !== 0) return $input; 
+  else { //serialized date array
+    $date = unserialize($input);
+    return date(DATE_ISO8601, mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
+  }
+}
Index: rdf_plugin_style.inc
===================================================================
RCS file: rdf_plugin_style.inc
diff -N rdf_plugin_style.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ rdf_plugin_style.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,27 @@
+<?php
+
+class rdf_plugin_style extends views_plugin_style {
+  
+  /**
+   * Set default options
+   */
+  function options(&$options) {
+    $options['vocabulary'] = 'FOAF';
+  }
+  
+  /**
+   * Provide a form for setting options.
+   *
+   * @param array $form
+   * @param array $form_state
+   */  
+  function options_form(&$form, &$form_state) {
+    $form['vocabulary'] = array(
+      '#type' => 'radios',
+      '#title' => t('RDF vocabulary'),
+      '#options' => array('FOAF' => t('FOAF')),
+      '#default_value' => $this->options['format'],
+    );
+  }
+
+}
Index: views_xml.module
===================================================================
RCS file: views_xml.module
diff -N views_xml.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_xml.module	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,52 @@
+<?php
+//$Id: views_xml.module,v 1.1.4.2 2008/07/07 19:55:39 allisterbeharry Exp $
+/**
+ @file views_xml.module
+ Module definition for views_xml 
+ @see views_xml.views.inc
+*/
+
+/**
+ * Implementation of hook_views_api().
+ *
+ * This one is used as the base to reduce errors when updating.
+ */
+function views_xml_views_api() {
+  return array(
+    'api' => 2,
+  );
+}
+
+/**
+ * Strips illegal Unicode characters and encodes entities in string
+ *
+ * @param string $input
+ * @return string
+ */
+function views_xml_strip_illegal_chars($input) {
+  $output = preg_replace('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP
+        '\x{01}-\x{1F}'. //Non-printable ASCII characters
+        '\x{AD}'. // Soft-hyphen
+        '\x{2000}-\x{200F}'. // Various space characters
+        '\x{2028}-\x{202F}'. // Bidirectional text overrides
+        '\x{205F}-\x{206F}'. // Various text hinting characters
+        '\x{FEFF}'. // Byte order mark
+        '\x{FF01}-\x{FF60}'. // Full-width latin
+        '\x{FFF9}-\x{FFFD}'. // Replacement characters
+        '\x{0}]/u', // NULL byte
+        '', $input);
+  $output = str_replace('"', '&quot;', $output); //encode quote
+  $output = str_replace('&', '&amp;', $output); //encode ampersand
+  $output = str_replace("'", '&pos;', $output); //encode apostrophe
+  $output = str_replace('<', '&lt;', $output); //encode left-angled bracket
+  $output = str_replace('>', '&rt;', $output); //encode right-angled bracket
+  return $output;
+}
+
+function views_xml_is_date ($input) {
+	if (strpos($input, 'a:3:{s:5:"month"') !== 0) return $input; 
+	else { //serialized date array
+		$date = unserialize($input);
+		return date(DATE_ISO8601, mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
+	}
+}
Index: views_xhtml.module
===================================================================
RCS file: views_xhtml.module
diff -N views_xhtml.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_xhtml.module	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,52 @@
+<?php
+//$Id: views_xhtml.module,v 1.1.4.2 2008/07/07 19:36:46 allisterbeharry Exp $
+/**
+ @file views_xhtml.module
+ Module definition for views_xhtml 
+ @see views_xhtml.views.inc
+*/
+
+/**
+ * Implementation of hook_views_api().
+ *
+ * This one is used as the base to reduce errors when updating.
+ */
+function views_xhtml_views_api() {
+  return array(
+    'api' => 2,
+  );
+}
+
+/**
+ * Strips illegal Unicode characters and encodes entities in string
+ *
+ * @param string $input
+ * @return string
+ */
+function views_xhtml_strip_illegal_chars($input) {
+  $output = preg_replace('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP
+        '\x{01}-\x{1F}'. //Non-printable ASCII characters
+        '\x{AD}'. // Soft-hyphen
+        '\x{2000}-\x{200F}'. // Various space characters
+        '\x{2028}-\x{202F}'. // Bidirectional text overrides
+        '\x{205F}-\x{206F}'. // Various text hinting characters
+        '\x{FEFF}'. // Byte order mark
+        '\x{FF01}-\x{FF60}'. // Full-width latin
+        '\x{FFF9}-\x{FFFD}'. // Replacement characters
+        '\x{0}]/u', // NULL byte
+        '', $input);
+  $output = str_replace('"', '&quot;', $output); //encode quote
+  $output = str_replace('&', '&amp;', $output); //encode ampersand
+  $output = str_replace("'", '&pos;', $output); //encode apostrophe
+  $output = str_replace('<', '&lt;', $output); //encode left-angled bracket
+  $output = str_replace('>', '&rt;', $output); //encode right-angled bracket
+  return $output;
+}
+
+function views_xhtml_is_date ($input) {
+  if (strpos($input, 'a:3:{s:5:"month"') !== 0) return $input; 
+  else { //serialized date array
+    $date = unserialize($input);
+    return date(DATE_ISO8601, mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
+  }
+}
Index: views-view-rdf.tpl.php
===================================================================
RCS file: views-view-rdf.tpl.php
diff -N views-view-rdf.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views-view-rdf.tpl.php	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,147 @@
+<?php
+// $Id: views-view-rdf.tpl.php,v 1.1.2.3 2008/07/09 06:47:58 allisterbeharry Exp $
+/**
+ * @file views-view-rdf.tpl.php
+ * View template to render views as RDF. Supports FOAF vocabulary.
+ *
+ * - $view: The view in use.
+ * - $rows: The raw result objects from the query, with all data it fetched.
+ * - $options: The options for the style passed in from the UI.
+ *
+ * @ingroup views_templates
+ * @see views_rdf.views.inc
+ */
+
+if (get_class($view->style_plugin->row_plugin) !== 'unformatted_plugin_row') {
+  print ('<b style="color:red">The row plugin is not of type Unformatted.</b>');
+  return;
+}
+else if (($view->style_plugin->row_plugin->options['separator']) !== '|') {
+  print ('<b style="color:red">The row plugin separator is not "<span style="color:blue">|</span>" (you can set this in the options for the row style plugin.)</b>');
+  return;
+}
+
+$nodes = array();
+foreach($rows as $row) {
+  $nodes[] = explode("|", trim($row));
+  
+}
+
+if ($options['vocabulary'] == 'FOAF') rdf_foaf_xml_render($nodes, $view);
+
+/**
+ * Render nodes as FOAF in XML
+ *
+ * @param array $nodes
+ * @return none
+ */
+function rdf_foaf_xml_render($nodes, $view) {
+  $xml .= '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
+  $xml .= '<!-- generator="Drupal Views_Datasource.Module" -->'."\n";
+  $xml .= '<rdf:RDF xmlns="http://xmlns.com/foaf/0.1"'."\n";
+  $xml .= '  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"'."\n";
+  $xml .= '  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"'."\n";
+  $xml .= '  xmlns:dc="http://purl.org/dc/elements/1.1/"'."\n";
+  $xml .= '  xmlns:foaf="http://xmlns.com/foaf/0.1/">'."\n";
+  foreach ($nodes as $node) {
+    $xml.="<foaf:Person>\n";
+    foreach($node as $nodefield) {
+      $nodefieldarray = explode(":", $nodefield);
+
+      /*replace escaped colons with actual colon*/
+      $nodefieldarray[0] = str_replace('#colon#', ':', $nodefieldarray[0]);
+      $nodefieldarray[1] = str_replace('#colon#', ':', $nodefieldarray[1]);
+
+      $label = views_rdf_strip_illegal_chars($nodefieldarray[0]);
+      $value = views_rdf_strip_illegal_chars(views_rdf_is_date($nodefieldarray[1]));
+      if (strtotime($value))
+        $value = date(DATE_ISO8601, strtotime($value));
+      if (is_null($value) || ($value === '')) continue;
+      if (stripos($label, 'firstname') !== false) {
+        $xml.="  <foaf:firstName>$value</foaf:firstName>\n";
+        continue;
+      }      
+      if (stripos($label, 'surname') !== false) {
+        $xml.="  <foaf:surName>$value</foaf:surName>\n";
+        continue;
+      }      
+      if ((stripos($label, 'name') !== false) && !((stripos($label, 'surname') !== false) || (stripos($label, 'firstname') !== false))) {
+        if (stripos($xml, "<foaf:name>") == false)
+          $xml.="  <foaf:name>$value</foaf:name>\n";
+        continue;
+      }
+      if (stripos($label, 'title') !== false) {
+        $xml.="  <foaf:title>$value</foaf:title>\n";
+        continue;
+      }
+      if (stripos($label, 'nick') !== false) {
+        $xml.="  <foaf:nick>$value</foaf:nick>\n";
+        continue;
+      }
+      if (stripos($label, 'mbox_sha1sum') !== false) {
+        $xml.="  <foaf:mbox_sha1sum>$value</foaf:mbox_sha1sum>\n";
+        continue;
+      }
+      if ((stripos($label, 'mbox') !== false) && !(stripos($label, 'mbox_sha1sum') !== false)) {
+        $xml.="  <foaf:mbox>$value</foaf:mbox>\n";
+        continue;
+      }
+      if (stripos($label, 'openid') !== false) {
+        $xml.="  <foaf:openid>$value</foaf:openid>\n";
+        continue;
+      }
+      if (strpos($label, 'workplaceHomepage') !== false) {
+        $xml.='  <foaf:workplaceHomepage rdf:resource="'.$value.'"/>'."\n";
+        continue;
+      }
+      if (strpos($label, 'homepage') !== false) {
+        $xml.='  <foaf:homepage rdf:resource="'.$value.'"/>'."\n";
+        continue;
+      } 
+      if (stripos($label, 'weblog') !== false) {
+        $xml.='  <foaf:weblog rdf:resource="'.$value.'"/>'."\n";
+        continue;
+      }
+      if (strpos($label, 'img') !== false) {
+        $xml.='  <foaf:img rdf:resource="'.$value.'"/>'."\n";
+        $xml.='  <foaf:depiction rdf:resource="'.$value.'"/>'."\n";
+        continue;
+      }
+      if (stripos($label, 'member') !== false) {
+        $xml.="  <foaf:member>$value</foaf:member>\n";
+        continue;
+      }      
+      if (stripos($label, 'phone') !== false) {
+        $xml.="  <foaf:phone>$value</foaf:phone>\n";
+        continue;
+      }
+      if (stripos($label, 'jabberID') !== false) {
+        $xml.="  <foaf:jabberID>$value</foaf:jabberID>\n";
+        continue;
+      }
+      if (stripos($label, 'msnChatID') !== false) {
+        $xml.="  <foaf:msnChatID>$value</foaf:msnChatID>\n";
+        continue;
+      }
+      if (stripos($label, 'aimChatID') !== false) {
+        $xml.="  <foaf:aimChatID>$value</foaf:aimChatID>\n";
+        continue;
+      }
+      if (stripos($label, 'yahooChatID') !== false) {
+        $xml.="  <foaf:yahooChatID>$value</foaf:yahooChatID>\n";
+        continue;
+      }            
+    }
+    $xml.="</foaf:Person>\n";
+  }
+  $xml.="</rdf:RDF>\n";
+  if ($view->override_path) //inside live preview 
+    print htmlspecialchars($xml);
+  else {  
+   print $xml;
+   module_invoke_all('exit');
+   exit;
+  }  
+  
+}
+  
Index: views_xml.views.inc
===================================================================
RCS file: views_xml.views.inc
diff -N views_xml.views.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_xml.views.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,41 @@
+<?php
+//$Id: views_xml.views.inc,v 1.1.2.1 2008/07/07 19:55:39 allisterbeharry Exp $
+/**
+ * @file views_xml.views.inc 
+ * Views style plugins to render nodes in the XML data format.
+ * @see views-view-xml.tpl.php
+ * @ingroup views_plugins
+ */
+
+/**
+ * Implementation of hook_views_plugin
+ *
+ */
+function views_xml_views_plugins() {
+  return array(
+    'style' => array( //declare the views_xml_* style plugins
+      'views_xml' => array(
+        'title' => t('XML data document'),
+        'theme' => 'views_view_xml',
+        'help' => t('Displays nodes as XML.'),
+        'handler' => 'xml_plugin_style',
+        'uses row plugin' => TRUE,
+        'uses fields' => TRUE,
+        'uses options' => TRUE,
+        'type' => 'normal',       
+      ),
+    ),
+  );
+}
+
+/**
+ * Theme preprocess function for views-view-xml.tpl.php
+ *
+ * @param array $vars
+ */
+function template_preprocess_views_view_xml(&$vars) {
+  $view     = &$vars['view'];
+  $options  = $view->style_handler->options;
+  $handler  = $view->style_handler;
+}
+
Index: views_datasource.module
===================================================================
RCS file: views_datasource.module
diff -N views_datasource.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_datasource.module	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,12 @@
+<?php
+
+/**
+ * Implementation of hook_views_api().
+ *
+ * This one is used as the base to reduce errors when updating.
+ */
+function views_datasource_views_api() {
+  return array(
+    'api' => 2,
+  );
+}
Index: views_datasource.views.inc
===================================================================
RCS file: views_datasource.views.inc
diff -N views_datasource.views.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_datasource.views.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,58 @@
+<?php
+//$Id: views_datasource.views.inc,v 1.1.2.1 2008/07/07 19:55:39 allisterbeharry Exp $
+/**
+ * @file views_datasource.views.inc 
+ * Views style plugins to render nodes in the XML data format.
+ * @see views-view-xml.tpl.php
+ * @ingroup views_plugins
+ */
+
+/**
+ * Implementation of hook_views_plugin
+ *
+ */
+function views_datasource_views_plugins() {
+  return array(
+    'row' => array( //declare the unformatted row plugin
+      'unformatted' => array(
+        'title' => t('Unformatted'),
+        'help' => t('(Displays the unformatted data for each row from the views query with each row on a new line. Set as | for views_json.'),
+        'handler' => 'unformatted_plugin_row',
+        'theme' => 'views_view_row_unformatted',
+        'uses fields' => TRUE,
+        'uses options' => TRUE,
+        'type' => 'normal',
+      )
+     ) 
+  );
+}
+
+/**
+ * Theme preprocess function for views-view-row-unformatted.tpl.php
+ */
+function template_preprocess_views_view_row_unformatted(&$vars) {
+  $view = $vars['view'];
+  //print('preprocess');
+  // Loop through the fields for this view.
+  foreach ($view->field as $id => $field) {
+    if (!empty($field->handler) && is_object($field->handler)) {
+      $object = new stdClass();
+      $object->content = $field['handler']->theme($vars['row']);
+      if (isset($field['handler']->field_alias) && isset($vars['row']->{$field['handler']->field_alias})) {
+        $object->raw = $vars['row']->{$field['handler']->field_alias};
+      }
+      else {
+        $object->raw = NULL; // make sure it exists to reduce NOTICE
+      }
+      if (!empty($vars['options']['separator']) && $object->content) {
+        $object->separator = filter_xss($vars['options']['separator']);
+      }
+
+      $object->handler = $field['handler'];
+      $object->class = views_css_safe($id);
+      $object->label = check_plain($field['handler']->label());
+      $vars['fields'][$id] = $object;
+    }
+  }
+  
+} 
Index: views_rdf.info
===================================================================
RCS file: views_rdf.info
diff -N views_rdf.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_rdf.info	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,6 @@
+name = Views RDF
+description = "Views style plugin to render node content as RDF."
+package = Views Datasource
+dependencies[] = views_datasource
+core = 6.x
+
Index: views_rdf.views.inc
===================================================================
RCS file: views_rdf.views.inc
diff -N views_rdf.views.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_rdf.views.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,41 @@
+<?php
+//$Id: views_rdf.views.inc,v 1.1.2.1 2008/07/07 19:58:29 allisterbeharry Exp $
+/**
+ * @file views_rdf.views.inc 
+ * Views style plugin to render nodes in the RDF data format.
+ * @see views-view-rdf.tpl.php
+ * @ingroup views_plugins
+ */
+
+/**
+ * Implementation of hook_views_plugin
+ *
+ */
+function views_rdf_views_plugins() {
+  return array(
+    'style' => array( //declare the views_rdf style plugin
+      'views_rdf' => array(
+        'title' => t('RDF data document'),
+        'theme' => 'views_view_rdf',
+        'help' => t('Displays nodes in the RDF data format.'),
+        'handler' => 'rdf_plugin_style',
+        'uses row plugin' => TRUE,
+        'uses fields' => TRUE,
+        'uses options' => TRUE,
+        'type' => 'normal',       
+      ),
+    ),
+  );
+}
+
+
+/**
+ * Theme preprocess function for views-view-rdf.tpl.php
+ *
+ * @param array $vars
+ */
+function template_preprocess_views_view_rdf(&$vars) {
+  $view     = &$vars['view'];
+  $options  = $view->style_handler->options;
+  $handler  = $view->style_handler;
+}
Index: xml_plugin_style.inc
===================================================================
RCS file: xml_plugin_style.inc
diff -N xml_plugin_style.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ xml_plugin_style.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,27 @@
+<?php
+
+class xml_plugin_style extends views_plugin_style {
+  
+  /**
+   * Set default options
+   */
+  function options(&$options) {
+    $options['schema'] = 'raw';
+  }
+  
+  /**
+   * Provide a form for setting options.
+   *
+   * @param array $form
+   * @param array $form_state
+   */  
+  function options_form(&$form, &$form_state) {
+    $form['schema'] = array(
+      '#type' => 'radios',
+      '#title' => t('Schema'),
+      '#options' => array('raw' => t('raw'),'opml'=> t('opml')),
+      '#default_value' => $this->options['schema'],
+    );
+  }
+
+}
Index: xhtml_plugin_style.inc
===================================================================
RCS file: xhtml_plugin_style.inc
diff -N xhtml_plugin_style.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ xhtml_plugin_style.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,27 @@
+<?php
+
+class xhtml_plugin_style extends views_plugin_style {
+  
+  /**
+   * Set default options
+   */
+  function options(&$options) {
+    $options['format'] = 'hcard';
+  }
+  
+  /**
+   * Provide a form for setting options.
+   *
+   * @param array $form
+   * @param array $form_state
+   */  
+  function options_form(&$form, &$form_state) {
+    $form['format'] = array(
+      '#type' => 'radios',
+      '#title' => t('Microformat'),
+      '#options' => array('hcard' => t('hCard')),
+      '#default_value' => $this->options['format'],
+    );
+  }
+
+}
Index: unformatted_plugin_row.inc
===================================================================
RCS file: unformatted_plugin_row.inc
diff -N unformatted_plugin_row.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ unformatted_plugin_row.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Implementation of views_row_plugin
+ *
+ */
+class unformatted_plugin_row extends views_plugin_row {
+	
+	/**
+	 * Set default options
+	 *
+	 * @param array $options
+	 */
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['separator'] = array('default'=>'|');
+    return $options;
+  }
+
+  /**
+   * Provide a form for setting options.
+   */
+  function options_form(&$form, &$form_state) {
+    $fields = $this->display->handler->get_option('fields');
+    $options = array();
+    foreach ($fields as $field => $info) {
+      $handler = views_get_handler($info['table'], $info['field'], 'field');
+      if ($handler) {
+        $options[$field] = $handler->ui_name();
+      }
+    }
+  
+    $form['separator'] = array(
+      '#title' => t('Separator'),
+      '#type' => 'textfield',
+      '#size' => 10,
+      '#default_value' => isset($this->options['separator']) ? $this->options['separator'] : ',',
+      '#description' => t('The separator is placed between fields.'),
+    );
+  }
+  
+}
Index: views_xhtml.views.inc
===================================================================
RCS file: views_xhtml.views.inc
diff -N views_xhtml.views.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_xhtml.views.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,40 @@
+<?php
+//$Id: views_xhtml.views.inc,v 1.1.2.1 2008/07/07 19:36:46 allisterbeharry Exp $
+/**
+ * @file views_xhtml.views.inc 
+ * Views style plugin to render nodes as XHTML microformats.
+ * @see views-view-xhtml.tpl.php
+ * @ingroup views_plugins
+ */
+
+/**
+ * Implementation of hook_views_plugin
+ *
+ */
+function views_xhtml_views_plugins() {
+  return array(
+    'style' => array( //declare the views_xhtml style plugin
+      'views_xhtml' => array(
+        'title' => t('XHTML data document'),
+        'theme' => 'views_view_xhtml',
+        'help' => t('Displays nodes as XHTML microformats.'),
+        'handler' => 'xhtml_plugin_style',
+        'uses row plugin' => TRUE,
+        'uses fields' => TRUE,
+        'uses options' => TRUE,
+        'type' => 'normal',       
+      ),
+    ),
+  );
+}
+
+/**
+ * Theme preprocess function for views-view-xhtml.tpl.php
+ *
+ * @param array $vars
+ */
+function template_preprocess_views_view_xhtml(&$vars) {
+  $view     = &$vars['view'];
+  $options  = $view->style_handler->options;
+  $handler  = $view->style_handler;
+}
Index: views_xml.info
===================================================================
RCS file: views_xml.info
diff -N views_xml.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_xml.info	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,6 @@
+name = Views XML
+description = "Views style plugin to render node content as XML"
+package = Views Datasource
+dependencies[] = views_datasource
+core = 6.x
+
Index: views_datasource.info
===================================================================
RCS file: views_datasource.info
diff -N views_datasource.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views_datasource.info	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,5 @@
+name = Views Datasource
+description = "Views style plugin to render node content as different data types."
+package = Views Datasource
+dependencies[] = views
+core = 6.x
