At 02:45 PM 09/22/2000 -0400, Imran Zaidi wrote:
>OK, so it's easy enough to store flat XML structures in an SQL database:
>The above is a simple example of the standard data record structure that
>easily spills out into a table format or whatever.
>My problem arises when you have complex, irregular XML.
Ah. Yes. What you're experiencing are the classic "data-vs.-documents"
conflicts: Is an instance of XML a "document"? or is it data?
The deposits-window example you sent along is clearly much more
document-like than data-like. In fact, what it resembles is not so much a
database -- even a complex one, with lots of little-bitty lookup tables and
so on -- but rather a word-processed document, with lots of special styles.
So a "Concept" element maps onto a document template; a "Name" element maps
onto a heading; "Para" is Normal style, "Bold" (making a leap here :) is
bold, and "InTextField" is a whaddayacallit, like a Field Code in word.
I don't think there's any easy way to reconcile the two views. I've never
done it myself, but I've heard of DBMS's which can store entire XML
documents as BLOBs (I think Oracle is one which does so, or lets you choose
that option). SQL Server may as well.
If I were setting out to do something like you're talking about -- actually
creating a DBMS from a more or less free-form document -- I might try to
conjure up a way to represent those things like Para, Bold, and InTextField
as properties. Brainstorming here.... Represent a document as a set of
consecutive records, one field of which is a memo type, then of course
you'd need some kind of key, and there'd be a separate table of text
properties which is keyed to records in the "document" table... something
like this (need fixed-font):
Doc # Rec # String
----- ----- ----------------------------
0001 0001 The Deposits Window
0001 0002 When you enter payment... such as the
0001 0003 Receive Payments window
0001 0004 , you can either immediately
0001 0005 Deposit to Account
Doc # Rec # Property
----- ----- -------------
0001 0001 Name
0001 0002 Para
0001 0003 Bold
0001 0004 Para
0001 0005 InTextField
Entries in the Properties table would have to allow for text in the
Document table to carry multiple properties at once, I guess.
Kind of a stretch, you think?
John E. Simpson | "If you were going to
http://www.flixml.org | shoot a mime, would you use
XML Q&A: http://www.xml.com | a silencer?" (Steven Wright)