function taxonomy_xml_rdf_document in Taxonomy import/export via XML 5
Same name and namespace in other branches
- 5.2 rdf_format.inc \taxonomy_xml_rdf_document()
- 6.2 rdf_format.inc \taxonomy_xml_rdf_document()
- 6 rdf_format.inc \taxonomy_xml_rdf_document()
- 7 rdf_utils.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
1 call to taxonomy_xml_rdf_document()
- taxonomy_xml_rdf_create in ./
rdf_format.inc - Return an XML/RDF document representing this vocab
File
- ./
rdf_format.inc, line 490 - Include routines for RDF parsing and taxonomy/term creation.
Code
function taxonomy_xml_rdf_document() {
$dom = new domdocument('1.0', 'UTF-8');
$dom
->appendchild($dom
->createcomment(htmlentities("\n This file was created by Drupal taxonomy_xml import/export tool. \n http://drupal.org/project/taxonomy_xml\n\n The RDF schema in this file is intended to follow the Working Draft\n described at http://www.w3.org/TR/wordnet-rdf/ for the notation of\n thesauri and taxonomies.\n ")));
$dom
->appendchild($dom
->createprocessinginstruction('xml-stylesheet', 'href="render-taxonomy-rdf.xsl" type="text/xsl"'));
$domcontainer = $dom
->createelementns(TAXONOMY_XML_RDF_NS, 'rdf:RDF');
# $rdfnode->setattribute('xmlns', TAXONOMY_XML_RDFS_NS);
$dom
->appendchild($domcontainer);
// 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_RDFS_NS, 'rdfs:title', "Initializing namespace in PHP is hard");
$domcontainer
->setattributens(TAXONOMY_XML_OWL_NS, 'owl:hack', "Initializing namespace in PHP is hard");
// 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;
}