This is indeed a very good idea.
A couple of years ago, I proposed a database abstraction layer called DBO to do this kind of thing. You specify the structure as a schema and then create visitors which walk the schema and perform various operations such as queries, validations, views, etc.
A colleague of mine at the time produced a working demo which you can find in my CPAN directory (id: abw) but it is known to be flaky and more of an experiment than a working product. By all means have a look, but don't expect too much from it :-)
The biggest problem was the lack of a standard way to represent the schema. The recent W3C XML Schema specification addresses this issues and provides a flexible and standards based way to do just this. I've started work on an XML::Schema module which will grok XML schemas and should allow you to build all sorts of cool schema based applications on top of it. Things like automatically generating database abstraction layers, SQL <-> object marshalling code, display/edit forms, validation and so on.
Watch this space, but bear in mind that XML Schema is non trivial, so don't hold your breath waiting for anything too soon.
In reply to Re: representing database schema in XML
by abw
in thread representing database schema in XML
by d_i_r_t_y
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |