function taxonomy_xml_rdf_export_term in Taxonomy import/export via XML 6.2
Same name and namespace in other branches
- 7 taxonomy_xml_rdf.inc \taxonomy_xml_rdf_export_term()
Return a term as RDF. Header and all
2 string references to 'taxonomy_xml_rdf_export_term'
- taxonomy_xml_add_terms_as_rdf in ./
rdf_format.inc - Given a list of terms, append definitions of them to the passed DOM container
- taxonomy_xml_menu in ./
taxonomy_xml.module - Implementation of hook_menu: Define menu links.
File
- ./
rdf_format.inc, line 1134 - Include routines for RDF parsing and taxonomy/term creation. @author dman http://coders.co.nz
Code
function taxonomy_xml_rdf_export_term($term, $depth = -1, $max_depth = NULL) {
if (is_numeric($term)) {
$term = taxonomy_get_term($term);
}
// Load in all extra data
module_invoke_all('taxonomy_term_load', $term);
$domcontainer = taxonomy_xml_rdf_document();
$dom = $domcontainer->ownerDocument;
taxonomy_xml_add_terms_as_rdf($domcontainer, $term);
// Now start adding terms.
// They are listed as siblings, not children of the ontology
$tree = module_invoke('taxonomy', 'get_tree', $term->vid, $term->tid, $depth, $max_depth);
taxonomy_xml_add_terms_as_rdf($domcontainer, $tree);
$result = $dom
->savexml();
// Minor layout tweak for readability
$result = preg_replace('|(<[^<]*/[^>]*>)|', "\$1\n", $result);
$result = preg_replace('|><|', ">\n<", $result);
# dpm($result);
print $result;
exit;
}