DB result set to XML -
You can write a little framework on top of
JDBC layer that converts the resultset into an XML document. All column names will become element tags with column values as element content. Since JDBC allows you to retrieve column names from the result set, this shouldn't be too difficult.
XML to DB insert/update/delete
Once you've figured out how want to represent the result set as XML document, this step should be easy, since it is the exact reverse of the previous step. Using a parser, you will extract the element names( which maps to column names ) and elemement content ( which maps to column value ) and build the actual SQL statement.
Remember, XML by itself doesnot have the intelligence to "ask" the database to interpret its content for generating queries. Since XML is pure data, it becomes your onus to provide the middle-tier that looks at the data and take an appropriate action.
Having said that, I encourage you to take a look at various database vendors who are coming up with
built-in XML support( the new acronym is XQL !!). Oracle for instance, in their latest version 8i has added extensive XML support. You can create table that has XML columns in it, build relational queries across normal columns and XML columns, retrieve the resultset in an XML format and submit queries as XML documents.
Checkout
the XML Home at Oracle Technet website for very interesting articles and free downloads.
We're getting there....
------------------
Ajith Kallambella M. Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.