You are here

function taxonomy_xml_rdf_document in Taxonomy import/export via XML 7

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

Set up an RDF document preamble.

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

4 calls to taxonomy_xml_rdf_document()
taxonomy_xml_rdfs_create in ./rdfs_format.inc
Return an XML/RDF document representing this vocab
taxonomy_xml_rdfs_export_term in ./rdfs_format.inc
Return a single term as RDF. Header and all
taxonomy_xml_rdf_create in formats/rdf_format.inc
Return an XML/RDF document representing this vocab
taxonomy_xml_rdf_create_term in formats/rdf_format.inc
Return a term as RDF-XML.

File

./rdf_utils.inc, line 145
Experimental library for working with RDF within taxonomy_xml

Code

function taxonomy_xml_rdf_document() {
  $dom = new DOMDocument('1.0', 'UTF-8');
  $ns = rdf_get_namespaces();
  $dom
    ->appendchild($dom
    ->createprocessinginstruction('xml-stylesheet', 'href="render-taxonomy-rdf.xsl" type="text/xsl"'));
  $dom
    ->appendchild($dom
    ->createcomment(xmlentities("\n    This file was created by Drupal taxonomy_xml import/export tool.\n    http://drupal.org/project/taxonomy_xml\n    ")));
  watchdog(__FUNCTION__, print_r(get_defined_vars(), 1));
  $domcontainer = $dom
    ->createelementns($ns['rdf'], 'rdf:RDF');
  $dom
    ->appendchild($domcontainer);

  // Here's how to add namespace declarations right.
  // http://bytes.com/topic/net/answers/468470-how-declare-namespace-prefix-java#post1800600
  $domcontainer
    ->setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:rdfs", $ns['rdfs']);
  $domcontainer
    ->setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:owl", $ns['owl']);
  $domcontainer
    ->setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:skos", $ns['skos']);
  return $domcontainer;
}