You are here

function taxonomy_xml_export_term in Taxonomy import/export via XML 6.2

Same name and namespace in other branches
  1. 7 taxonomy_xml.export.inc \taxonomy_xml_export_term()

Return a representation of the requested term

@todo UNFINISHED, currently a stub copy from full vocab export

File

./taxonomy_xml.module, line 281
This module makes it possible to import and export taxonomies as XML documents.

Code

function taxonomy_xml_export_term($tid, $format = 'rdf') {
  $term = is_numeric($term) ? taxonomy_term_load($term) : $term;
  module_load_include('inc', 'taxonomy_xml', $format . '_format');
  taxonomy_xml_include_module_hooks();
  $create_funcname = "taxonomy_xml_{$format}_create_term";
  $file = $create_funcname($tid);
  if (!empty($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.5') || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera'))) {
    header('Content-Type: application/dummy');
  }
  else {
    header('Content-Type: text/xml; charset=UTF-8');
  }
  if (headers_sent()) {
    echo 'Some data has already been output to browser, can\'t send file';
  }
  header('Content-Length: ' . drupal_strlen($file));
  header("Content-Disposition: attachment; filename=taxonomy_{$vname}.{$format}.xml");
  echo $file;
}