//Prepare Handler
$handler->setOrder($order);
$handler->setFilter($filter);
//Get data
$rows = $handler->getAll();
$columns = $handler->getFieldNames();
$dgx = new DataGridXML($columns, $rows);
header('Content-Type: text/xml');
if (ini_get('zlib.output_compression') == false) {
    if (function_exists('ob_gzhandler')) {
        ob_start('ob_gzhandler');
    }
}
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
//construct XML
echo $dgx->getXML();
require_once BADGER_ROOT . "/includes/fileFooter.php";
/**
 * Indicates an unsuccessful transfer from string to target type
 */
class TransferException extends Exception
{
    /**
     * Default handler
     */
    function TransferException($message = null, $code = 0)
    {
        parent::__construct($message, $code);
    }
}
/**
$dgx4 = new DataGridXML();
echo "dgx4 setRows: \n";
$dgx4->setColumns($columns1);
$dgx4->setRows($rows1);
printDGX($dgx4);
echo "dgx4 setRows: Overwrite \n";
$dgx4->setRows($rows2);
printDGX($dgx4);
$dgx5 = new DataGridXML();
echo "dgx5 addRows to empty rows: \n";
$dgx5->setColumns($columns1);
$dgx5->addRows($rows1);
printDGX($dgx5);
echo "dgx5 addRows to filled rows: \n";
$dgx5->addRows($rows1);
printDGX($dgx5);
echo "dgx5 addRow (single) to filled rows: \n";
$dgx5->addRow(array("Hackfresse", "Hans", "Dobi"));
printDGX($dgx5);
echo "dgx5 emptyRows: \n";
$dgx5->emptyRows();
printDGX($dgx5);
$dgx6 = new DataGridXML();
echo "dgx6 getXML Exception Test \n";
try {
    $dgx6->getXML();
    echo "no exception";
} catch (Exception $ex) {
    echo $ex;
}
require_once BADGER_ROOT . "/includes/fileFooter.php";