From: Todd F. <ta...@le...> - 2004-09-06 06:26:25
|
I would make the following modification to your proposed representation: <?xml version="1.0" encoding="UTF-8"?> <database> <metadata> <table name="table1"> <col name="COL1" type="type1"/> <col name="COL2" type="type2"/> </table> <table name="table2"> <col name="COL1" type="type1"/> <col name="COL2" type="type2"/> </table> </metadata> <data table="table1> <row><COL1></COL1><COL2><![CDATA[binary data or otherwise necessary to escape data]]></COL2></row> <row><COL1></COL1></row> <row><COL1></COL1><COL2><![CDATA[]]></COL2></row> <row><COL1></COL1></row> </data> </database> * Nulls are easily handled by a missing column. * Blobs can be delt with using CDATA, you might want to use this for text too although text might be just as well escaping. The trade off I see with this format over what you had proposed earlier is that this format solves the above to issues, while perhaps adding an additional cost in size by a facter of 2 times the length of each column name. This is balanced in my opinion by two factors: 1. XML can be compressed at least one inparticular libxml can read gzipped files. Meaning increased disk space is really a mute point. 2. It is typically faster to process XML with fewer attributes. Attribute parsing tends to be slower then simple tag processing. I would also use UTF-8 encoding over ASCII; doing should leave open the possiblity of your xml being used in many more locales. -todd p.s. Perhaps I missed somewhere, but what is the reason for representing the tables/data in the database in an xml format? Just curious ;-) Leyne, Sean wrote: >Jim, > > > >>My evolving XML schema looks like this: >> >> <?xml version="1.0" encoding="US-ASCII"?> >> <database> >> <metadata> >> <table name="MESSAGES"> >> <column name="TRANS_NOTES" type="blob"/> >> <column name="EXPLANATION" type="blob"/> >> <column name="ACTION" type="blob"/> >> <column name="TEXT" type="varchar" precision="118"/> >> <column name="CODE" type="int"/> >> <column name="FLAGS" type="smallint"/> >> <column name="NUMBER" type="smallint"/> >> <column name="FAC_CODE" type="smallint"/> >> <column name="SYMBOL" type="varchar" precision="32"/> >> <column name="ROUTINE" type="varchar" precision="32"/> >> <column name="MODULE" type="varchar" precision="32"/> >> </table> >> </metadata> >> <data> >> <rows table="MESSAGES"> >> <row TEXT="Do you want to roll back your updates?" >>CODE="10351" NUMBER="351" FAC_CODE="1" SYMBOL="" >>ROUTINE="process_statement"/> >> <row TEXT="gen_descriptor: dtype not recognized" >>CODE="10352" NUMBER="352" FAC_CODE="1" ROUTINE="gen_descriptor"/> >> <row TEXT="MOVQ_move: conversion not done" CODE="10047" >>NUMBER="47" FAC_CODE="1"/> >> <row TEXT="BLOB conversion is not supported" >> >> >CODE="10048" > > >>NUMBER="48" FAC_CODE="1" SYMBOL="" ROUTINE=""/> >> <row TEXT="expected type" CODE="10000" NUMBER="0" >>FAC_CODE="1"/> >> </rows> >> </data> >> </database> >> >>The key questions, I think, are how data is presented. My starting >> >> >point > > >>is: >> >>* A table row is represented as a single xml element >>* Each non-null column is presented by an xml attribute >> >> > >The representation proposed is exactly how I define XML schemas -- not >sure you'll think this is a good thing ;-) > >You will have a problem with large text/blob columns. There is a size >restriction for attribute items. > >I don't recall the size limit, off the top of my head. I am >investigating and will reply back. > > > >>* Null columns are not represented >>* No special casing of blob values are supported >>* Column attributes are based on JDBC definitions >> >> > > >------------------------------------------------------- >This SF.Net email is sponsored by BEA Weblogic Workshop >FREE Java Enterprise J2EE developer tools! >Get your free copy of BEA WebLogic Workshop 8.1 today. >http://ads.osdn.com/?ad_idP47&alloc_id808&opÌk >Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel > > > |