From 0089eb2415010763e4c94159e86f86536aaf9871 Mon Sep 17 00:00:00 2001 From: Gerald Simane Date: Tue, 1 Dec 2009 19:32:08 +0000 Subject: [PATCH] --- include/functions.inc.php | 76 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/include/functions.inc.php b/include/functions.inc.php index 0893c51c7..dd04cfd34 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -589,4 +589,80 @@ function check_utf8($str="") return $stati; } +// ------------------------------------------------------------------------------------------ +// Konertierungen +// ------------------------------------------------------------------------------------------ + + +// ------------------------------------------------------------------------------------------ +// DB Array Konvertieren zu XML +// ------------------------------------------------------------------------------------------ + function array_to_xml($rows,$root='root') + { + if (!count($rows)) + return '<'.$root.' />'."\r\n"; + + $xml_string=''; + $xml_string.='<'.$root.'>'."\r\n"; + reset($rows); + + for ($i=0;$i'."\r\n"; + } + elseif (is_numeric($tmp_key)) + { + $xml_string.=''."\r\n"; + } + } + $xml_string.=''."\r\n"; + } + $xml_string.=''."\r\n"; + return $xml_string; + } + +// ------------------------------------------------------------------------------------------ +// DB Array Konvertieren zu RDF +// ------------------------------------------------------------------------------------------ + function array_to_rdf($rows,$root='root',$rdf_uri='rdf') + { +##exit(" $root $rdf_uri "); + + $rdf_server=$_SERVER['SERVER_NAME']; + $rdf_string=''; + if (!count($rows)) + return $rdf_string.='<'.strtoupper($rdf_uri).':'.$root.' />'."\r\n"; + +# $rdf_string.='<'.strtoupper($rdf_uri).':'.$root.'>'."\r\n"; + $rdf_string.='<'.strtoupper($rdf_uri).':Seq rdf:about="http://'.$rdf_server.'/'.$root.'/liste">'."\r\n"; + + reset($rows); + for ($i=0;$i'."\r\n"; + $rdf_string.='<'.strtoupper($rdf_uri).':Description id="'.$i.'" about="http://'.$rdf_server.'/liste'.$i.'">'."\r\n"; + + $row=$rows[$i]; + reset($row); + while (list( $tmp_key, $tmp_value ) = each($row) ) + { + if (!is_numeric($tmp_key)) + { + $rdf_string.='<'.strtoupper($rdf_uri).':'.$tmp_key.'>'."\r\n"; + } + } + $rdf_string.=''."\r\n"; + $rdf_string.=''."\r\n"; + } +# $rdf_string.=''."\r\n"; + $rdf_string.=''."\r\n"; + return $rdf_string; + } ?>