[XML-SIG] How to convert my data in database to XML

Book Stack bookstack at gmail.com
Fri May 6 06:24:58 CEST 2005


That sounds very interesting. Let me make make myself more clear.

I need one middle layer between the database and presentation.
Suppose the filter from/to between XML and dataset is xmlSerializer.
The DDL and XML schema is determined in the runtime, xmlSerializer
is feed with this information with xmlSerializer.conf, i.e a xml, .conf
whatever,

xmlSerializer should provide the following information:

a. How to execute a query. 
  We could use stored procedure, view or other mechanism to easy this
process.

b. How to map the dataset to the xml file
c. How to map xml to dataset.

This would be kind complicated if involving multi-table query. I would
like dig into
the sqlobject for more inspiration.

Thanks.



Lloyd Kvam wrote:

>Your SQL database will support SQL commands like DESCRIBE TABLE.  For
>MySQL I have used:
>    cursor.execute( 'SHOW COLUMNS FROM %s' % tablename)
>    for row in cursor.fetchall():
>        fname = row[0]		# my live code also saved the type info
>
>to build a dictionary of field names and types for a table to control
>processing.
>
>I presume your XML is supposed to look something like:
>
><tablename>
><record>
><fieldname1>value_1</fieldname1>
><fieldname2>value_2</fieldname2>
>...
></record><record>
>...
></tablename>
>
>If that description fits what you are trying to do, then you should not
>have too much difficulty coding up the pieces.  This glosses over
>difficulties with XML character rules in tags and elements, encoding
>binary data, etc.
>
>On Thu, 2005-05-05 at 15:09 -0600, Uche Ogbuji wrote:
>  
>
>>On Wed, 2005-05-04 at 03:03 -0400, Kun Xi wrote:
>>    
>>
>>>Hello. I have the same question:
>>>The data is store in Sql database, but the database schema is determined
>>>in the runtime. I need to generate the xml file without knowing the
>>>table structure, sound insane? Is there any tool, framework that could
>>>read the configuration file and serialize the xml file from/to the
>>>database ?
>>>
>>>I don't need the o/r mapping, I just need a filter between the xml and
>>>database.
>>>      
>>>
>>And by "configuration file", I assume you mean SQL DDL.
>>
>>This is the sort of thing that most DBMS vendors sell as features or
>>add-ons.  Many OSS projects have such tools as well.  I don't know of
>>anything general purpose in Python for this.
>>
>>    
>>
>
>  
>



More information about the XML-SIG mailing list