DB Designer 4 TO Propel Schema Converter
By Jonathan Graham - Last Update: 14 November 2006
DB Designer | Propel
NOTE: As of 11/14/2006, dbd2propel has been added to the Propel repository. This conversion page now uses the latest version of the xsl file from the repository.

Comments
Here is the php code.
Paste DB Designer 4 XML:


PHP Code
Here is the code that processes the DB Designer xml... of course this could be streamlined if one were using PHP 5.
<?
function transform() {
    
    if ( !isset(
$_REQUEST["xml"]) ) {
        echo 
"<h3>Must enter an XML string!</h3>";
        return;
    }

    
$xmlstr stripslashes($_REQUEST["xml"]);

    
$xml = new DomDocument// from /ext/dom
    
$xml->loadXML($xmlstr);
    
    
$xsl = new DomDocument;
    
$xsl->load("http://propel.phpdb.org/trac/browser/trunk/contrib/dbd2propel/dbd2propel.xsl?format=txt");
    
    
$proc = new xsltprocessor;
    
$proc->importStyleSheet($xsl); // attach the xsl rules
    
$xmlstr $proc->transformToXML($xml);
    
    echo 
"<strong>Propel Schema XML:</strong>";
    echo 
"<hr><pre style=\"font-size:9pt\">";
    echo 
htmlentities($xmlstr);
    echo 
"</pre><hr>";
}
?>