[Zope] Parsing XML into/out of the database

Tony McDonald tony.mcdonald@ncl.ac.uk
Thu, 18 Mar 1999 22:33:01 +0000


Hi all,

I have an application that consists of 140+ XML documents, roughly 100k
bytes each that I want to be able to query (using XSL pattern matching at
present) and output to XML/HTML and RTF format. This will happen in real
time (if at all possible).

At the moment, my XML documents are held as files in a real file system
(sacrilige! :). However, I'd like to get them into the database structure if
at all possible, as I imagine it will make things easier in terms of
searching. For example, the XML file

<?xml version="1.0"?>
<document title="Cell Biology">
<topic title="introduction" id="cb1">
    Cell Biology is a good thing. If it weren't for Cell Biology, you
    wouldn't be around.
</topic>
<topic title="lectures" id="cb2">
    <topic title="lecture" id="cb2" num="1">
    This is lecture 1.
    </topic>
<topic title="lecture" id="cb3" num="2">
    This is lecture 2.
</topic>
<topic title="reading list" id="cb4">
    <topic title="bok" id="cb5">
        A big bok
    </topic>
</topic>
</topic>

Would lend itself to creation in the Zope database really easily (I think).
XML elements (document, topic) and attributes such as id (used to uniquely
identify an element) and title would be properties of the DTML
document/method. So long as the id numbers were properly arranged, it should
be *relatively* (good word that!) simple to recreate the original XML
document. I assume that parsing the XML (in actual fact, the DTML doc/method
would consist of *very little* XML I think, it all being taken care of in
properties) to create HTML would be, again, relatively easy (my own tendency
is to use the 'title' attribute as a class identifier for cascading style
sheets).

My question is, do people think that this idea could fly? I have spent *a
long time* looking at how to get our Word (sorry for saying that!) documents
into a format that means they can be easily put into a database and thereby
benefit from all the good things that means. Several cul-de-sacs and wasted
weekends later, it seems to me that Zope is coming out to be the closest
thing to a solution for my problem...

(I know from off-list discussions that there's a definite 'weirdness' about
how people have been wanting/needing to implement things and then finding
that (a) Zope does it already, (b) there's a product available or (c)
someones working on it... !).

any thoughts, as usual, greatly appreciated.
tone.