> Both were rightly offended by the thought of devising a DTD that helped
> get round the difficulties of storing mixed content data. But if you
Not by the thought of devising a DTD for it, just by the complexity of
an attribute for what would otherwise be the intervening bits of data
in mixed content.
> And if you think about it, it's pretty obvious why. XML's 'revolution'
> is to come up with a consistent way of representing data and meta data.
Er. No. This has been possible in regular SGML since the beginning.
XML just took away the nubbly bits and made the syntax stricter.
> 1. How you actually represent that in a database - which is where we
> came in on this debate.
Look at the documents on XPointers: they deal with the same problem in
a slightly different way -- amongst which is the problem of how to
identify spans of text which are in mixed content but otherwise
> Now this IS interesting. From a database point of view, XML is amazing.
This is very interesting. Can you identify what it is that XML doing
that makes it amazing, and what SGML didn't have?
> It is far more significant than mere text mark-up. IMHO it is worth
> broadening your notion of what a 'document' is, after all, there is
> nothing in the XML spec. that says a document is a play by Shakespeare,
> or an insurance claim. In fact it could be a list of historical GDP
> figures for a country.
No-one has ever suggested it couldn't be, but I'd suggest that using
XML markup to identify that kind of data is inefficient.
> > The attribute table has a join on the element table to say what
> > element the attribute belongs to, whilst the element has joins
> > to itself to say who the parent of an element is. This allows
> > us to store an object-like tree structure, and so generate XML
> > documents from any point in the tree.
Not being a database person, I'm still hazy on what this means, but I
think it means that if you list all the attributes and all the
elements, you can draw a line joining an attribute to the element it
belongs to, and between elements to show hierarchy. This is highly
dangerous approach, because it changes the nature of the
attributes. In an SGML system, an attribute belongs ONLY to the
element or elements against which it was declared. That is to say, you
<!ELEMENT food (#PCDATA)>
<!ATTLIST food group CDATA #REQUIRED>
where "group" could be "fat", "sugar", "beer", "chocolate", or any of
the other standard foodgroups, but
<!ELEMENT font (#PCDATA)>
<!ATTLIST font group (sans|serif|script) #IMPLIED>
which can have a completely different meaning. If I understand the
"table" approach, it flattens the collection of attributes which occur
in a DTD into a single list, in which "group" occurs only once, with
joins to "food" and "font" element types. This would be an error, as
far as I can see. But maybe I've missed something.
> To re-iterate, I suggested a way of storing objects in a relational
> database that only uses about three or four tables, yet can store
> elements, attributes, and - very importantly - their hierarchical
I'd want to look very hard at the way it identifies attributes.
> relationship. Once established, that 'object database' can be used to
> store data that can be exported as XML. And it is very, very easy to
> export XML that contains mixed content. (As well as DTDs, XSL and
> whatever else we feel like.)
I think you;re right, but I don't see what's so special or new about it.
> But secondly - although I hate being pedantic, you guys bring it out of
> me - what it human-legible? No-one has defined it, but everyone loves to
ASCII or a character set that can be read in an editor without
conversion or interpretation. Even with difficulty (like having to
make your eye skip over pointy bracket bits).
> throw it around. Is a bitmap human legible?
No, its binary.
> bytes. Yet has the bitmap changed between the two situations? Further,
> is an XML file stored on your hard disk but with no copy of notepad on
> the computer human legible?
Yes. You can type MORE MYFILE.XML in a DOS window and read it.
> meaningful way without needing anything more advanced than a simple text
> editor. This is not really for humans sake - are you really going to
> curl up in bed with Midsummer Nights Dream all tagged up? It is more to
No, but I often have to get into people's files with a plaintext editor
to fix up the things that more foolish software has corrupted.
> that the entire XML universe contains only the complete works of
> Shakespeare - one document for each play - then the traditional method
> still makes it difficult to find every play which features a Prince.
> With our solution of storing the documents in an object structure, with
> each node being an element, we can actually export our search results as
> a new XML document. Searching for the word "Yorrick" could create a
> document on the fly, that contained the name of the play, act, scene and
> speaker, where the word occurred.
I still don't see what's new about this. Software to do this in SGML
has been around for over a decade.
> More than this, with the 'separate document' solution how do you create
> a table of contents? You can create a separate document, but what if
> someone discovers a new work by Shakespeare? You'd have to add the new
> play and then edit your table of contents document. Our solution would
> do it automatically, since the table of contents is a 'virtual' XML
> document, created as a query on the XML objects. This automation is what
> databases are good at.
Everything you say is perfectly correct, but you're treating it as if
it was discovered yesterday. The only problem with existing systems is
they tend to be expensive...