XMl - DTD and Table Definition

Kay Michael Michael.Kay at icl.com
Mon Jun 14 16:44:18 BST 1999


> I am in the area of XML! Now I have to export and import 
> large databases via XML-format. This data are structured in typical 
> master-detail relations (1 master have approximatly 15 to 25 details
records, one 
> exportfile have 30000 - 500000 master elements).
> If I write the details records like the standard XML format, shown in 
> serveral books and samples via www, I waste a lot of space 
> for Start-End-Tag's.  To minimize the filesize, I decide to use the
<table><th><td> 
> syntax.

The "standard" format you refer to (presumably something like
<BOOKS><BOOK><AUTHOR>Shakespeare</AUTHOR><TITLE>Hamlet</TITLE></BOOK></BOOKS
>)
is not a standard at all, it is merely a convention that many people use.

If space is a concern (and with big databases it certainly is) there are
several other approaches possible:
1. Compress the file using a standard compression utility.
2. Use shorter tags ( e.g. <A> for <AUTHOR> )
3. Identify columns by position rather than by name, for example:
<BOOKS COLUMNS="AUTHOR TITLE">
<R><C>Shakespeare</C><C>Hamlet</C></R>
This is similar to using TABLE & TD as you suggest (but shorter). You need
to think about how to represent null values, though: and if there are very
many nulls, you can end up using more space than with the named columns
approach.
4. If space is really tight you could even shorten the above to:
<R>Shakespeare<S/>Hamlet</R>
(where the empty tag <S/> acts as a separator); but you're starting to make
it more difficult to parse, eliminating the benefits of using XML in the
first place.
  
> Questions:
> 
> Is this allowed in a "well-formed" XML document?
Yes, you can use tags to mean anything you like so long as they are properly
nested.

Mike Kay

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/ and on CD-ROM/ISBN 981-02-3594-1
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