How do I easily create the DDL statements for a schema represented by the contents of an XML file?
have a look at liquibase - it's a great tool, and sounds like what you are looking for. 
You could use it to create SQL statements using the updateSQL command or apply changes directly to the DB.

for example:

java -jar liquibase.jar \
    --driver=oracle.jdbc.OracleDriver \
    --classpath=jdbcdriver.jar \
    --url=jdbc:oracle:thin:@localhost:1521:oracle \
    --username=scott \
    --password=tiger \
    updateSQL &gt; /tmp/script.sql


will output the required changes to the scripts.sql file.

It supports many db servers including Postgres, and you can model your schema in XML, JSON or any way you like.
See: XML changeset  

&lt;changeSet id="1" author="nvoxland"&gt;
    &lt;createTable tableName="person"&gt;
        &lt;column name="id" type="int" autoIncrement="true"&gt;
            &lt;constraints primaryKey="true" nullable="false"/&gt;
        &lt;/column&gt;
        &lt;column name="firstname" type="varchar(50)"/&gt;
        &lt;column name="lastname" type="varchar(50)"&gt;
            &lt;constraints nullable="false"/&gt;
        &lt;/column&gt;
        &lt;column name="state" type="char(2)"/&gt;
    &lt;/createTable&gt;
&lt;/changeSet&gt;


It's open source and actively maintained. 

We've been using it on multiple projects and dbs - highly recommended :)