You are here

function taxonomy_xml_add_vocab_as_rdf in Taxonomy import/export via XML 6.2

Same name and namespace in other branches
  1. 5.2 rdf_format.inc \taxonomy_xml_add_vocab_as_rdf()
  2. 5 rdf_format.inc \taxonomy_xml_add_vocab_as_rdf()
  3. 6 rdf_format.inc \taxonomy_xml_add_vocab_as_rdf()

Create a vocabulary definition (just the def, not its terms) and insert it into the given document element.

Parameters

$domcontainer an XML dom document, modified by ref.:

$vocabulary a vocab object:

1 call to taxonomy_xml_add_vocab_as_rdf()
taxonomy_xml_rdf_create in ./rdf_format.inc
Return an XML/RDF document representing this vocab

File

./rdf_format.inc, line 1005
Include routines for RDF parsing and taxonomy/term creation. @author dman http://coders.co.nz

Code

function taxonomy_xml_add_vocab_as_rdf(&$domcontainer, $vocabulary) {
  $dom = $domcontainer->ownerDocument;
  $vocabnode = taxonomy_xml_entity_to_rdf($vocabulary, 'taxonomy_vocabulary', $domcontainer);

  // That has already added it to the document - required to prevent it adding dummy namespaces
  $vocabulary->uri = taxonomy_xml_taxonomy_vocabulary_uri($vocabulary);
  $vocabnode
    ->setattributens(TAXONOMY_XML_RDF_NS, 'rdf:ID', $vocabulary->uri['id']);

  // Apparently rdf:ID and rdf:about on the same element is illegal. Hm.
  // Use xml:base instead. http://www.ibm.com/developerworks/xml/library/x-tiprdfai.html
  $domcontainer
    ->setattribute('xml:base', url($vocabulary->uri['path'], array(
    'absolute' => TRUE,
  )));
  $vocabnode
    ->appendchild($dom
    ->createelementns(TAXONOMY_XML_OWL_NS, 'owl:versionInfo', xmlentities(format_date($_SERVER['REQUEST_TIME'], 'long'))));
}