You are here

function AtoX in Bibliography Module 7

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

File

includes/biblio_xml.inc, line 56
Copyright (C) 2006-2011 Ron Jerome.

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;
}