Mark Birbeck wrote:

> Emin asked:
> > can anyone give me an idea about how to store XML documents on a
> > relational database (i.e. ORACLE)
> That depends on how flexible you want to be. You could just create a
> large field that contains the whole document, or you could store the
> document in a file system and place a reference to it in the DB. Both
> solutions make searching a bit tricky, and I would regard them as quite
> 'static', since obtaining a smaller part of a document is awkward.
> We use a simple technique where we have a table for attributes and a
> table for elements. 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.

This is excellent server-side-only technique. Yet as Mr. Birbeck is clearly

> Note that some of the discussions on the site so far make me sure there
> will be disagreements with this approach, the recent request for
> examples of 'pure XML' applications being one. The view seems to be to
> put all the functionality on the client, but in our situation to achieve
> the cross-referencing between articles we wanted, we would have had to
> pass down every article from every issue.

there is real question of how XML-ish this approach is. Before going any
further, let me disclaim any intent to prescribe anyone's use of XML or of
any other tool. That said, we might usefully enquire why XML is specifically
suited or particularly useful for Mr. Birbeck's approach. Reading somewhat
between the lines, I see two XML advantages which Mr. Birbeck seems to have
exploited. One of them he emphasizes as a means of enhancing output from his

> We provide a number of default 'styles' to deliver the XML - for example
> one for normal
> viewing, one for clearer printing, and one as a view to email to someone.
> This is all supplemented by an entry point that gets 'documents' out as
> raw XML.

> Our approach reduces the quantity of data passed to a minimum. Just say,
> for example, that a
> portal site carried the titles of some of the lead articles from our site,
> with a paragraph summary and a link to us. We can now distribute all that
> data as straight XML to the portal, who then format it as they wish. The
> moment we put a new issue online, the portal site changes.
> That to me is a useful application of XML, even though when you look at
> the pages of the magazine online you will only see HTML because the style
> has already been merged on our server.

The other XML advantage which Mr. Birbeck is apparently exploiting is to use
XML documents as input to his database. These can be created with simple
text editors and proofed 'by eyeball' far more quickly and easily than
traditional data entry could get the same element and attribute
information--and, more significantly, the structure of the relationships
among them--into the database. By itself, this may be a decisive advantage
which compels the commitment to XML.

OTOH, from the client, or user's, point of view there is little here which
the HTML-viewed-in-a-browser paradigm does not offer. True, the sidebar
which indexes the browsed document is a cool and useful feature, but from
the client's viewpoint it is nothing which could not have been done in
straight HTML. The (admittedly enormous) labor savings in using XML to build
these indices benefit only the server side. My impatience with this is
because Mr. Birbeck has the core of a truly distributed database and then
settles for a static visual presentation of HTML to the client. Having
already built everything required for it, why doesn't he give me, the
client, element-level access to his database. Yes, this will require more
client-side functionality than a browser, but it is for a different purpose
than the browser, and actually orthogonal to it. There will be those
(probably a majority for some time to come) who will be content simply to
view the static presentation which is, at present, the end product of Mr.
Birbeck's very clever database work. Nevertheless, why shouldn't I be able
to mount client-side essentially the same database plus XML parser and
XML<=>database application which Mr. Birbeck is using? Client-side, I could
create complex data structures which incorporated, by database reference,
the data elements which Mr. Birbeck is already maintaining, together with
data elements of my own or data elements from other sites like Mr.
Birbeck's, which he and his data know nothing of. To fill my data request,
Mr. Birbeck would need only transmit a stream of XML equivalent to what he
already provides to server-side portals.

I realize that this has gotten far afield from the original question, but
just as Mr. Birbeck answered 'how to store XML documents?' with 'how to use
(at least one way) XML documents which are stored in a relational database',
I am suggesting another possibility, based on a different notion of what
'use' in this situation might mean.

Walter Perry