I have been working on a similar problem but approaching it in a slightly different way. I have taken more of an object-relational mapping approach similar to products such as TopLink. Using this approach you define your database schema and your XML result schema separately and then map them together. For instance, the SQL tables for Employees (i.e. Employee, Department, Person) will be mapped directly to your resulting XML document and that document can be structured like:

            <department>

                        <name>accounting</name>

                        <employee>

                                    <firstName>John</firstName>

                                    <lastName>Doe</lastName>

                                    <employeeId>1234</employeeId>

                        </employee>

                        <employee>

                                   

                        </employee>

            </department>

 

or it could be structured like:

            <employee deptName=”accounting” id=”1234”>

                        <firstName>John</firstName>

                        <lastName>Doe</lastName>

            </employee>

 

or any other variation.

 

The mapping (created against a defined mapping schema as an XML document) provides the information that is needed to build the queries and create the resulting documents. XSLT is not used and the typical result type from an XML query (<table name=”department”><row><column name=”deptId”>360</column>…</row>…</table><table>…</table>) is not used. The query is truly symmetric. You can define the result format, submit queries using that format, and receive responses in that format. To qualify your query you include the known data elements and the query will be built to find those.

 

I have been working on this independently and would be interested in comments. I currently have the query definition, submit, and response working for moderately complex data sets (involving many-to-many relations that can be brought to multiple places in the XML document) and will work on defining insert and update as well.

 

- Glenn

 

Reply via email to