From: Jim S. <ja...@ne...> - 2004-09-06 15:55:27
|
Todd Fisher wrote: > 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"/> > <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. I don't see the merit of replacing the tag "column" with a column name. It doesn't follow general xml schema rules and it leads to a big problem with column names that are valid xml tags. As for CDATA, it may be useful for a cleaner representation of text with lots of characters that need escapes, but it really don't work at all for binary data. All sorts of things tend to break with things like nulls and backspaces are included in more or less ascii files. I'm currently testing for the presence of a byte value below 10 (decimal) and dropping into base64. An examples follows <?xml version="1.0" encoding="US-ASCII"?> <database> <metadata> <table name="RDB$TRIGGERS"> <column name="RDB$TRIGGER_NAME" type="char" precision="32"/> <column name="RDB$RELATION_NAME" type="char" precision="32"/> <column name="RDB$TRIGGER_SEQUENCE" type="smallint"/> <column name="RDB$TRIGGER_TYPE" type="smallint"/> <column name="RDB$TRIGGER_SOURCE" type="clob"/> <column name="RDB$TRIGGER_BLR" type="blob"/> <column name="RDB$DESCRIPTION" type="clob"/> <column name="RDB$TRIGGER_INACTIVE" type="smallint"/> <column name="RDB$SYSTEM_FLAG" type="smallint"/> <column name="RDB$FLAGS" type="smallint"/> <index name="RDB$INDEX_38"> <column name="RDB$RELATION_NAME"/> </index> <index name="RDB$INDEX_8" type="unique"> <column name="RDB$TRIGGER_NAME"/> </index> </table> </metadata> <data> <rows table="RDB$TRIGGERS"> <row> <column name="RDB$TRIGGER_NAME">RDB$TRIGGER_1</column> <column name="RDB$RELATION_NAME">RDB$USER_PRIVILEGES</column> <column name="RDB$TRIGGER_SEQUENCE">0</column> <column name="RDB$TRIGGER_TYPE">3</column> <column name="RDB$TRIGGER_BLR" encoding="base64">/F6.H.**</column> <column name="RDB$SYSTEM_FLAG">1</column> </row> <row> <column name="RDB$TRIGGER_NAME">RDB$TRIGGER_8</column> <column name="RDB$RELATION_NAME">RDB$USER_PRIVILEGES</column> <column name="RDB$TRIGGER_SEQUENCE">0</column> <column name="RDB$TRIGGER_TYPE">5</column> <column name="RDB$TRIGGER_BLR" encoding="base64">/EUvDFQ.1Z72EWF4GIJAF3xCEIp3/oA/GVBGF26YIYJAEJF7HotTFYZ3H2FH .oQu9lQ12J72EWFGFIl/J2ZDHZxCEIp33k.FIYF07373H23IGIxCLot/HIIj 3kACIYF072N7FIl2Lot/HIIL..tGF26YFYZ3H2FTHY3BFTw001QL.l7GF26Y IoJ1JJ77J3ZTEol/IpAJ1UY.Ip3A72RGEItI.UR1.IcIIYF073B3EpJGGJFN LoBAEJBHFJA2FmwL//7GF26YIoJ1JJ77J3ZTEol/IpAL.l7GF26YIoJ1JJ77 J3ZTEol/IpDz.UI2zkc1/E6/9FQ32Z72EWFHFIBJIYZIKJx1H23HIzzzzzzz H.**</column> <column name="RDB$SYSTEM_FLAG">1</column> </row> |