From 7fddfcf56b6f89d80900effc8ce8bc4995abb1d6 Mon Sep 17 00:00:00 2001 From: chriskl Date: Mon, 18 Aug 2003 07:21:44 +0000 Subject: [PATCH] revise XML format --- HISTORY | 2 ++ tblexport.php | 26 ++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index ddca9b64..85cbb938 100644 --- a/HISTORY +++ b/HISTORY @@ -27,6 +27,8 @@ Features: * When browsing data, numeric types are aligned right * Ability to create unique and partial indexes * View and edit table comments +* Changed XML format significantly. Now doesn't use field names as + tag names, outputs column type information, and is in correct XML format! Bug Fixes: * Lots of NULL value in table dump fixes (XML format changed slightly) diff --git a/tblexport.php b/tblexport.php index 02b4fbc4..1ea9f811 100644 --- a/tblexport.php +++ b/tblexport.php @@ -3,7 +3,7 @@ /** * Does an export to the screen or as a download * - * $Id: tblexport.php,v 1.8 2003/08/03 03:14:13 chriskl Exp $ + * $Id: tblexport.php,v 1.9 2003/08/18 07:21:45 chriskl Exp $ */ $extensions = array( @@ -64,20 +64,34 @@ echo "\\.\n"; } elseif ($_REQUEST['format'] == 'xml') { - echo "\n"; + echo "\n"; + echo "\n"; + if (!$rs->EOF) { + // Output header row + $j = 0; + echo "\t
\n"; + foreach ($rs->f as $k => $v) { + $finfo = $rs->fetchField($j++); + if ($k == $localData->id && !isset($_REQUEST['oids'])) continue; + $k = htmlspecialchars($k); + $type = htmlspecialchars($finfo->type); + echo "\t\t\n"; + } + echo "\t
\n"; + } while (!$rs->EOF) { echo "\t\n"; - while(list($k, $v) = each($rs->f)) { + foreach ($rs->f as $k => $v) { if ($k == $localData->id && !isset($_REQUEST['oids'])) continue; $k = htmlspecialchars($k); - $v = htmlspecialchars($v); - echo "\t\t<{$k}", ($v == null ? ' null="true"' : ''), ">{$v}\n"; + if ($v != null) $v = htmlspecialchars($v); + echo "\t\t{$v}\n"; } echo "\t\n"; $rs->moveNext(); } - echo "
\n"; + echo "\n"; } elseif ($_REQUEST['format'] == 'sql') { $data->fieldClean($_REQUEST['table']); -- 2.39.5