Is there a standard way of encoding SQL queries as XML? I mean something like
select name from users where name like 'P%' group by name order by name desc
might encode as (my 5-minute mockup, probably bobbins)...
<?xml version="1.0" encoding="UTF-8"?>
<query>
<select>
<table name="users">
<column name="name"/>
</table>
</select>
<from>
<table name="users"/>
</from>
<where>
<operator name="like">
<column name="name"/>
<value>P%</value>
</operator>
</where>
<aggregation>
<groupby>
<column name="name"/>
</groupby>
</aggregation>
<order>
<order-by>
<column name="name" order="desc"/>
</order-by>
</order>
</query>
...which would make it easy to build, store, validate structure and content (by producing a schema based on the database schema) etc.