<?php
/**
 * Questo file permette di generare le dtd
 * 
 * @desc Generazione dinamica di DTD
 * @package VFront
 * @subpackage VFront_XML
 * @author M.Marcello Verona
 * @copyright 2007-2010 M.Marcello Verona
 * @version 0.96 $Id: dtd.php 819 2010-11-21 17:07:24Z marciuz $
 * @license http://www.gnu.org/licenses/gpl.html GNU Public License 
 */


require("../inc/conn.php");
require("../inc/func.comuni.php");
require("../inc/func.frontend.php");

function genera_dtd($tabella,$solo_visibili=false){

	list($col,$is_null)= prendi_colonne_frontend($tabella,'column_name,is_nullable',$solo_visibili,intval($_SESSION['gid']));
	
	
	
$DTD='<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT recordset (row+)>
<!ELEMENT row ('.implode(",",$col).') >'."\n";


for($i=0;$i<count($col);$i++){
	
	$DTD.="<!ELEMENT ".$col[$i]." (#PCDATA) >\n";
	
}

$DTD.="
<!ATTLIST recordset tot CDATA #REQUIRED >
<!ATTLIST row offset CDATA #REQUIRED >	
";
	
	
return $DTD;
	
}

$solo_visibili= (int) $_GET['vis'];

$dtd= genera_dtd($_GET['action'],$solo_visibili);

header("Content-type: application/octet-stream");
echo $dtd;

?>