You are here

function AtoX in Bibliography Module 6

Same name and namespace in other branches
  1. 7 includes/biblio_xml.inc \AtoX()
  2. 7.2 includes/biblio.xml.inc \AtoX()
1 call to AtoX()
biblio_xml_export in ./biblio_xml.inc

File

./biblio_xml.inc, line 53

Code

function AtoX($array, $DOM = null, $root = null) {
  foreach ($array as $key => $value) {
    if ($key == 'biblio_contributors') {
      $name = 'contributor';
    }
    if (is_numeric($key)) {
      $key = 'c_' . $key;
    }
    if (is_array($value) && count($value)) {
      $subroot = $root
        ->appendChild($DOM
        ->createElement($key));
      AtoX($value, $DOM, $subroot);
    }
    else {
      if (!empty($value)) {
        $root
          ->appendChild($DOM
          ->createElement($key, htmlspecialchars($value, ENT_QUOTES)));
      }
    }
  }
  return $DOM;
}