private void buildSchema( ResultSet columns, InputStream schemaFile, String className, String tableName, Field[] fields ) {
Document document = DocumentHelper.createDocument();
Element root = document.addElement( "table" );
root.addAttribute( "name", tableName );
root.addAttribute( "className", className );
XMLWriter writer;
Element field;
HashMap<String, Field> fieldMap = new HashMap<String, Field>();
int i;
for( i = 0; i < fields.length; i++ ) {
fieldMap.put( fields[ i ].getName(), fields[ i ] );
}
try {
i = 0;
while( columns.next() ) {System.out.println( columns.getString( "COLUMN_NAME" ) );
field = root.addElement( "field" );
field.addAttribute( "id", Integer.toString( i++ ) );
field.addAttribute( "name", columns.getString( "COLUMN_NAME" ) );
field.addAttribute( "dbType", columns.getString( "DATA_TYPE" ) );
field.addAttribute( "javaType", fieldMap.get( columns.getString( "COLUMN_NAME" ) ).getType().toString() );
}
OutputFormat format = OutputFormat.createPrettyPrint();
writer = new XMLWriter( System.out, format );
//writer.write( document );
} catch( SQLException e ) {
} catch( IOException e ) {