Saturday, August 19, 2006

I have been thinking about the RDB generation. If the architecture is only semi-dynamic then its fairly easy to write some code that translates MySQL results to XML and vice-versa. Now obviously this would break if the XSD changed but its not that complicated so is fairly easy to maintain. The following article shows how this can be done:

http://www.kitebird.com/articles/mysql-xml.html

Its in PHP but shows how some simple scripts can convert to/from XML. When writing it assumptions would have to be made (e.g. you expect the "title" element as the first child element of "book" - but even this assumes more than necessary). We can just think about how the XSD we have maps to a RDB table and then look for certain complex types or patters to determine which table they belong to. It’s not nice but it is quick and easy – we can add complexity later if time permits.

Also if we don’t need a fully dynamic architecture then the MySQL schema can be created by us, it doesn’t need to be generated from an XML Schema. I will try and define an XML Schema for requests and responses and then define the database structure, just to get things kicked off.

1 Comments:

At Wed Aug 23, 02:45:00 pm 2006, Blogger Aaron Bishell said...

Ok cool. But I need some kind of db structure so I can start doing something.

I've created an SQL file and put it into:

http://xmldad.googlecode.com/svn/files/MoreXSDs/

Just to have something I can use to get some code examples.

The point is if the architecture doesn't have to be dynamic then its very simple to hard code some operations to map to/from XML to RDB operations.

 

Post a Comment

<< Home