You are here

function taxonomy_xml_tcs_document in Taxonomy import/export via XML 7

Same name and namespace in other branches
  1. 6.2 tcs_format.inc \taxonomy_xml_tcs_document()
  2. 6 tcs_format.inc \taxonomy_xml_tcs_document()

Set up a TCS document preamble.

Returns a document, also sets the passed handle to the RDF node that content should land in

This format based on inspection of the TCS schema (TCS101) and sample documents found at http://www.tdwg.org/standards/117/

1 call to taxonomy_xml_tcs_document()
taxonomy_xml_tcs_create in formats/tcs_format.inc
Return an XML/TCS document representing this vocab

File

formats/tcs_format.inc, line 334
Include routines for the Taxon Concepts Schema as used by "the Encyclopedia of Life" original XML parsing and taxonomy/term creation. and others.

Code

function taxonomy_xml_tcs_document() {
  $dom = new domdocument('1.0', 'UTF-8');
  $dom
    ->appendchild($dom
    ->createcomment(htmlentities('
    This file was created by Drupal taxonomy_xml import/export tool.
    http://drupal.org/project/taxonomy_xml
    This format is based on inspection of the TCS schema (TCS101) and sample
    documents found at http://www.tdwg.org/standards/117/
    ')));
  $dom
    ->appendchild($dom
    ->createprocessinginstruction('xml-stylesheet', 'href="render-taxonomy-tcs.xsl" type="text/xsl"'));
  $domcontainer = $dom
    ->createelementns(TAXONOMY_XML_TCS_NS, 'DataSet');
  $dom
    ->appendchild($domcontainer);

  #$domcontainer->setnamespace(TAXONOMY_XML_TCS_NS, 'tcs');
  $domcontainer
    ->setattribute("xmlns", TAXONOMY_XML_TCS_NS);

  // Why can't I set more namespaces?
  // By appending a namespaced att, the extra namespaces appear at the top.
  // Otherwise the appear everywhere. There must be a better way
  $domcontainer
    ->setattributens(TAXONOMY_XML_XSI_NS, 'xsi:schemaLocation', TAXONOMY_XML_TCS_SCHEMA);

  // Note that one way to get namespaces to work right is by adding new
  // elements to their context asap, not by waiting until after further bits are added.
  return $domcontainer;
}