XML representation of a Table

Pavel Velikhov pvelikho at cs.ucsd.edu
Wed Oct 21 22:10:54 BST 1998

Michael Kay wrote:

> One observation, in your DTD all the columns of the table are declared
> mandatory, this gives you no way of handling null values (the obvious
> representation of a null value is to omit the relevant element).
> Another issue you may need to address is that not every SQL table and column
> identifier is a valid XML name. For example, SQL identifiers can contain
> spaces.

It seems that throwing relational attributes into XML attributes overcomes both
problems - make all attributes optional, all that are missing are null.E.g.
<row action_id="A" action_desc="PASSTEST" ... />, everything that is not present
is null.
Not a space efficient representation however.

> You will also have to think about how to encode binary (blob) fields.

> For large tables your representation is very inefficient in space terms.
> Often we don't worry about this in XML work, but relational tables can reach
> gigabytes in size even without all these tags. An alternative I would
> consider for large tables is:
>   </COLUMNS>
> <ROW>A<C/>Activate<C/>A<C/>PASSTEST<C/>1998-02-23 09:44:00.000</ROW>
> <ROW>...</ROW>
> </TABLE>
> I don't think the gurus would recommend using empty elements as separators
> like this, but it is a perfectly legitimate use of XML.

My subjective view is that with current XML tools (msxml parser for example) its
a lot easier to process XML objects that store data in attributes rather than in
subobjects. Empty elements and PCDATA interleaved makes life complicated for no
good reason. Plus you have to care for order when creating tables in XML, instead
of just setting attributes in an arbitrary fashion.

> Finally, a transfer format for relational tables also needs to be able to
> represent the metadata; my example heads in this direction.

Is there a standard under development for such a thing? I.e. full scale transfer
format for relational tables in XML?

> Regards,
> Mike Kay

Pavel Velikhov

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

More information about the Xml-dev mailing list